Travis build: 987
This commit is contained in:
@ -229,7 +229,7 @@ hub<span class="token punctuation">.</span><span class="token function">off</spa
|
||||
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">insertAfter</span><span class="token punctuation">(</span>document<span class="token punctuation">.</span><span class="token function">getElementById</span><span class="token punctuation">(</span><span class="token string">'myId'</span><span class="token punctuation">),</span> <span class="token string">'<p>after</p>'</span><span class="token punctuation">);</span> <span class="token comment">// <div id="myId">...</div> <p>after</p></span>
|
||||
</pre></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="insertbefore">insertBefore</h4><p>Inserts an HTML string before the start of the specified element.</p><p>Use <code>el.insertAdjacentHTML()</code> with a position of <code>'beforebegin'</code> to parse <code>htmlString</code> and insert it before the start of <code>el</code>.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">insertBefore</span> <span class="token operator">=</span> <span class="token punctuation">(</span>el<span class="token punctuation">,</span> htmlString<span class="token punctuation">)</span> <span class="token operator">=></span> el<span class="token punctuation">.</span><span class="token function">insertAdjacentHTML</span><span class="token punctuation">(</span><span class="token string">'beforebegin'</span><span class="token punctuation">,</span> htmlString<span class="token punctuation">);</span>
|
||||
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">insertBefore</span><span class="token punctuation">(</span>document<span class="token punctuation">.</span><span class="token function">getElementById</span><span class="token punctuation">(</span><span class="token string">'myId'</span><span class="token punctuation">),</span> <span class="token string">'<p>before</p>'</span><span class="token punctuation">);</span> <span class="token comment">// <p>before</p> <div id="myId">...</div></span>
|
||||
</pre></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="isbrowsertabfocused">isBrowserTabFocused</h4><p>Returns <code>true</code> if the browser tab of the page is focused, <code>false</code> otherwise.</p><p>Use the <code>Document.hidden</code> property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">isBrowserTabFocused</span> <span class="token operator">=</span> <span class="token punctuation">()</span> <span class="token operator">=> !</span>document<span class="token punctuation">.</span>hidden<span class="token punctuation">;</span>
|
||||
</pre></div><div class="card code-card"><div class="section card-content"><h4><a href="https://frontendmasters.com/courses/javascript-hard-parts/" target="_blank" rel="noopener noreferrer">Recommended Resource - JavaScript: The Hard Parts</a></h4><p>Take your JavaScript to the next level. Gain an understanding of callbacks, higher order functions, closure, asynchronous and object-oriented JavaScript!</p></div></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="isbrowsertabfocused">isBrowserTabFocused</h4><p>Returns <code>true</code> if the browser tab of the page is focused, <code>false</code> otherwise.</p><p>Use the <code>Document.hidden</code> property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">isBrowserTabFocused</span> <span class="token operator">=</span> <span class="token punctuation">()</span> <span class="token operator">=> !</span>document<span class="token punctuation">.</span>hidden<span class="token punctuation">;</span>
|
||||
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">isBrowserTabFocused</span><span class="token punctuation">();</span> <span class="token comment">// true</span>
|
||||
</pre></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="nodelisttoarray">nodeListToArray</h4><p>Converts a <code>NodeList</code> to an array.</p><p>Use spread operator inside new array to convert a <code>NodeList</code> to an array.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">nodeListToArray</span> <span class="token operator">=</span> nodeList <span class="token operator">=></span> <span class="token punctuation">[</span><span class="token operator">...</span>nodeList<span class="token punctuation">];</span>
|
||||
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">nodeListToArray</span><span class="token punctuation">(</span>document<span class="token punctuation">.</span>childNodes<span class="token punctuation">);</span> <span class="token comment">// [ <!DOCTYPE html>, html ]</span>
|
||||
|
||||
Reference in New Issue
Block a user