diff options
Diffstat (limited to 'files/pt-br/web/api/document/currentscript/index.html')
-rw-r--r-- | files/pt-br/web/api/document/currentscript/index.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/files/pt-br/web/api/document/currentscript/index.html b/files/pt-br/web/api/document/currentscript/index.html new file mode 100644 index 0000000000..179c950916 --- /dev/null +++ b/files/pt-br/web/api/document/currentscript/index.html @@ -0,0 +1,99 @@ +--- +title: Document.currentScript +slug: Web/API/Document/currentScript +translation_of: Web/API/Document/currentScript +--- +<div>{{ ApiRef("DOM") }}</div> + +<div> </div> + +<p>Retorna o elemento que está sendo processado atualmente.</p> + +<h2 id="Syntax" name="Syntax">Sintaxe</h2> + +<pre class="syntaxbox">var curScriptElement = document.currentScript; +</pre> + +<h2 id="Example" name="Example">Exemplo</h2> + +<p>O exemplo abaixo verifica se o script está sendo executado de forma assíncrona:</p> + +<pre class="brush:js">if (document.currentScript.async) { + console.log("Execução assíncrona"); +} else { + console.log("Execução síncrona"); +}</pre> + +<p><a href="/samples/html/currentScript.html">View Live Examples</a></p> + +<h2 id="Nota">Nota</h2> + +<p>Se o código estiver sendo chamado como um callback ou manipulador de eventos, ele não irá referenciar o elemento; a referência ao elemento só acontece quando ele está sendo processado inicialmente.</p> + +<h2 id="Compatibilidade_nos_navegadores">Compatibilidade nos navegadores</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suporte Básico</td> + <td>29</td> + <td>{{ CompatGeckoDesktop("2.0") }}</td> + <td>{{ CompatNo() }} (as of IE11)</td> + <td>16</td> + <td> + <p>8 </p> + </td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suporte Básico</td> + <td>4.4</td> + <td><span style="font-size: 12px; line-height: 18px;">{{CompatVersionUnknown}}</span></td> + <td><span style="font-size: 12px; line-height: 18px;">{{CompatVersionUnknown}}</span></td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>iOS 8</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Specification" name="Specification">Especificações</h2> + +<ul> + <li><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript">HTML5</a></li> +</ul> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{HTMLElement("script")}}</li> + <li>{{domxref("element.onafterscriptexecute")}}</li> + <li>{{domxref("element.onbeforescriptexecute")}}</li> +</ul> |