diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/globaleventhandlers | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/api/globaleventhandlers')
12 files changed, 1283 insertions, 0 deletions
diff --git a/files/pt-br/web/api/globaleventhandlers/index.html b/files/pt-br/web/api/globaleventhandlers/index.html new file mode 100644 index 0000000000..1801888d2b --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/index.html @@ -0,0 +1,536 @@ +--- +title: GlobalEventHandlers +slug: Web/API/GlobalEventHandlers +tags: + - API + - DOM + - HTML-DOM + - Mixin + - NeedsTranslation + - Reference + - TopicStub +translation_of: Web/API/GlobalEventHandlers +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>The <strong><code>GlobalEventHandlers</code></strong> mixin describes the event handlers common to several interfaces like {{domxref("HTMLElement")}}, {{domxref("Document")}}, or {{domxref("Window")}}. Each of these interfaces can implement more event handlers.</p> + +<p><code>GlobalEventHandlers</code> is a mixin and not an interface and no object of this type can be created.</p> + +<h2 id="Properties">Properties</h2> + +<p>The events properties, of the form <code>onXYZ</code>, are defined on the {{domxref("GlobalEventHandlers")}}, and implemented by {{domxref("HTMLElement")}}, {{domxref("Document")}}, {{domxref("Window")}}, and {{domxref("WorkerGlobalScope")}} for Web Workers.</p> + +<dl> + <dt>{{domxref("GlobalEventHandlers.onabort")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("abort")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onblur")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("blur")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onerror")}}</dt> + <dd>Is an {{domxref("OnErrorEventHandler")}} representing the code to be called when the {{event("error")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onfocus")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("focus")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oncancel")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("cancel")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oncanplay")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("canplay")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oncanplaythrough")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("canplaythrough")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onchange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("change")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onclick")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("click")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onclose")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("close")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oncontextmenu")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("contextmenu")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oncuechange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("cuechange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondblclick")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dblclick")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondrag")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("drag")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragend")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragend")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragenter")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragenter")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragexit")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragexit")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragleave")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragleave")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragover")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragover")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondragstart")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("dragstart")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondrop")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("drop")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ondurationchange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("durationchange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onemptied")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("emptied")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onended")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("ended")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oninput")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("input")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.oninvalid")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("invalid")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onkeydown")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("keydown")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onkeypress")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("keypress")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onkeyup")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("keyup")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onload")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("load")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onloadeddata")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("loadeddata")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onloadedmetadata")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("loadedmetadata")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onloadstart")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("loadstart")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmousedown")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mousedown")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmouseenter")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mouseenter")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmouseleave")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mouseleave")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmousemove")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mousemove")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmouseout")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mouseout")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmouseover")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mouseover")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmouseup")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mouseup")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onmousewheel")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("mousewheel")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpause")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pause")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onplay")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("play")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onplaying")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("playing")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerdown")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerdown")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointermove")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointermove")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerup")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerup")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointercancel")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointercancel")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerover")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerover")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerout")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerout")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerenter")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerevent")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerleave")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerleave")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerlockchange")}} {{experimental_inline}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerlockchange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onpointerlockerror")}} {{experimental_inline}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pointerlockerror")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onprogress")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("progress")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onratechange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("ratechange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onreset")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("reset")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onscroll")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("scroll")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onseeked")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("seeked")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onseeking")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("seeking")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onselect")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("select")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onselectionchange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onshow")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("show")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onsort")}} {{experimental_inline}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("sort")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onstalled")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("stalled")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onsubmit")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("submit")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onsuspend")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("suspend")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ontimeupdate")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("timeupdate")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onvolumechange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("volumechange")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ontouchcancel")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("touchcancel")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ontouchend")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("touchend")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ontouchmove")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("touchmove")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.ontouchstart")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("touchstart")}} event is raised.</dd> + <dt>{{domxref("GlobalEventHandlers.onwaiting")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("waiting")}} event is raised.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<p><em>This interface defines no method.</em></p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("Selection API",'', 'Extension to GlobalEventHandlers')}}</td> + <td>{{Spec2('Selection API')}}</td> + <td>Adds <code>onselectionchange.</code></td> + </tr> + <tr> + <td>{{SpecName('Pointer Lock', '#extensions-to-the-document-interface', 'Extension of Document')}}</td> + <td>{{Spec2('Pointer Lock')}}</td> + <td>Adds <code>onpointerlockchange</code> and <code>onpointerlockerror</code> on {{domxref("Document")}}. It is experimentally implemented on <code>GlobalEventHandlers</code>.</td> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#globaleventhandlers', 'GlobalEventHandlers')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>No change since the latest snapshot, {{SpecName("HTML5.1")}}.</td> + </tr> + <tr> + <td>{{SpecName('HTML5.1', '#globaleventhandlers', 'GlobalEventHandlers')}}</td> + <td>{{Spec2('HTML5.1')}}</td> + <td>Snapshot of {{SpecName("HTML WHATWG")}}. Added <code>onsort</code> since the {{SpecName("HTML5 W3C")}} snapshot.</td> + </tr> + <tr> + <td>{{SpecName("HTML5 W3C", "#globaleventhandlers", "GlobalEventHandlers")}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td>Snapshot of {{SpecName("HTML WHATWG")}}. Creation of <code>GlobalEventHandlers</code> (properties where on the target before it).</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox (Gecko)</th> + <th>Chrome</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncanplay</code>, <code>oncanplaythrough</code>, <code>ondurationchange</code>, <code>onemptied</code>, <code>onended</code>, <code>onloadeddata</code>, <code>onloadedmetadata</code>, <code>onloadstart</code>, <code>onpause</code>, <code>onplay</code>, <code>onplaying</code>, <code>onprogress</code>, <code>onratechange</code>, <code>onseeked</code>, <code>onseeking</code>, <code>onstalled</code>, <code>ontimeupdate</code>, <code>onvolumechange</code>, <code>onwaiting</code></td> + <td>{{CompatGeckoDesktop(1.9.1)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onsuspend</code></td> + <td>{{CompatGeckoDesktop(1.9.2)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondrag</code>, <code>ondragend</code>, <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragover</code>, <code>ondragstart</code>, <code>ondrop</code></td> + <td>{{CompatGeckoDesktop(1.9.1)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmouseenter</code>, <code>onmouseleave</code></td> + <td>{{CompatGeckoDesktop(10)}}</td> + <td>30.0</td> + <td>5.5</td> + <td>17</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondragexit</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncancel</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onclose</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncuechange</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondragexit</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmousewheel</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onsort</code> {{experimental_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmozfullscreenchange</code>, <code>onmozfullscreenerror</code> {{non-standard_inline}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>onpointerlockchange</code>, <code>onpointerlockerror</code></td> + <td>{{CompatGeckoDesktop(10)}}<sup>[1]</sup></td> + <td>{{CompatVersionUnknown}}<sup>[2]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onpointercancel</code>, <code>onpointerdown</code>, <code>onpointerup</code>, <code>onpointermove</code>, <code>onpointerout</code>, <code>onpointerover</code>, <code>onpointerenter</code>, <code>onpointerleave</code></td> + <td>{{CompatVersionUnknown}}<sup>[3]</sup></td> + <td>{{CompatNo}}</td> + <td>10</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onselectionchange</code></td> + <td>{{CompatGeckoDesktop(43)}}<sup>[4]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ontouchend</code>, <code>ontouchcancel</code>, <code>ontouchmove</code>, <code>ontouchstart</code></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox Mobile (Gecko)</th> + <th>Android</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondrag</code>, <code>ondragend</code>, <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragover</code>, <code>ondragstart</code>, <code>ondrop</code></td> + <td>{{CompatGeckoMobile(1.9.1)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncanplay</code>, <code>oncanplaythrough</code>, <code>ondurationchange</code>, <code>onemptied</code>, <code>onended</code>, <code>onloadeddata</code>, <code>onloadedmetadata</code>, <code>onloadstart</code>, <code>onpause</code>, <code>onplay</code>, <code>onplaying</code>, <code>onprogress</code>, <code>onratechange</code>, <code>onseeked</code>, <code>onseeking</code>, <code>onstalled</code>, <code>ontimeupdate</code>, <code>onvolumechange</code>, <code>onwaiting</code></td> + <td>{{CompatGeckoMobile(1.9.1)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmouseenter</code>, <code>onmouseleave</code></td> + <td>{{CompatGeckoMobile(10)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onsuspend</code></td> + <td>{{CompatGeckoMobile(1.9.2)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondragexit</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncancel</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onclose</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>oncuechange</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ondragexit</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmousewheel</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onsort</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onmozfullscreenchange</code>, <code>onmozfullscreenerror</code> {{non-standard_inline}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>onpointerlockchange</code>, <code>onpointerlockerror</code></td> + <td>{{CompatGeckoMobile(10)}}<sup>[1]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onpointercancel</code>, <code>onpointerdown</code>, <code>onpointerup</code>, <code>onpointermove</code>, <code>onpointerout</code>, <code>onpointerover</code>, <code>onpointerenter</code>, <code>onpointerleave</code></td> + <td>{{CompatVersionUnknown}}<sup>[3]</sup></td> + <td>{{CompatNo}}</td> + <td>10</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>onselectionchange</code></td> + <td>{{CompatGeckoMobile(43)}}<sup>[4]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ontouchend</code>, <code>ontouchcancel</code>, <code>ontouchmove</code>, <code>ontouchstart</code></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] In Gecko this is implemented as <code>onmozpointerlockchange</code>, <code>onmozpointerlockerror</code>.</p> + +<p>[2] In Blink this is implemented as <code>onwebkitpointerlockchange</code>, <code>onwebkitpointerlockerror</code>.</p> + +<p>[3] This is implemented behind the <code>dom.w3c_pointer_events.enabled</code> preference, defaulting to <code>false</code>.</p> + +<p>[4] This is implemented behind the <code>dom.select_events.enabled</code> preference, that default to <code>false</code>, except on Nightly.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{domxref("Element")}}</li> +</ul> diff --git a/files/pt-br/web/api/globaleventhandlers/onabort/index.html b/files/pt-br/web/api/globaleventhandlers/onabort/index.html new file mode 100644 index 0000000000..9882a8b82d --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onabort/index.html @@ -0,0 +1,44 @@ +--- +title: GlobalEventHandlers.onabort +slug: Web/API/GlobalEventHandlers/onabort +translation_of: Web/API/GlobalEventHandlers/onabort +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<h2 id="Summary" name="Summary">Sumário</h2> + +<p>Um manipulador de eventos que aborta eventos enviados para a janela. (Não disponível para o Firefox 2 ou Safari)</p> + +<p>TODO define what "abort" is. Closing the window via window manager? Stopping the load of the page? By which means and reasons (user, network/server)? At which stages would it fire / be catched? For IE, onabort is only available with <code>img</code> tags.</p> + +<h2 id="Syntax" name="Syntax">Sintaxe</h2> + +<pre class="syntaxbox">window.onabort =<em>funcRef</em> +</pre> + +<ul> + <li><code>funcRef</code>: Reference to a function</li> +</ul> + +<h2 id="Example" name="Example">Exemplo</h2> + +<pre class="brush:js">window.onabort = function() { + alert("Load aborted."); +}</pre> + +<h2 id="Specification" name="Specification">Especificação</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onabort','onabort')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> diff --git a/files/pt-br/web/api/globaleventhandlers/onblur/index.html b/files/pt-br/web/api/globaleventhandlers/onblur/index.html new file mode 100644 index 0000000000..ee4133a0da --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onblur/index.html @@ -0,0 +1,94 @@ +--- +title: GlobalEventHandlers.onblur +slug: Web/API/GlobalEventHandlers/onblur +tags: + - API + - HTML DOM + - Propriedade + - Referencia +translation_of: Web/API/GlobalEventHandlers/onblur +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>The <strong>onblur</strong> property returns the onBlur event handler code, if any, that exists on the current element.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox">element.onblur = function; +</pre> + +<ul> + <li><code>function</code> é o nome de uma função definida pelo usuário, sem o sufixo () ou qualquer parâmetro, ou uma declaração de função anônima, como por exemplo</li> +</ul> + +<pre class="syntaxbox">element.onblur = function() { console.log("evento onblur detectado!"); }; +</pre> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: html"><html> + +<head> +<title>exemplo de evento onblur</title> + +<script type="text/javascript"> + +var elem = null; + +function initElement() +{ + elem = document.getElementById("foo"); + // NOTA: doEvent(); ou doEvent(param); NÃO irão funcionar aqui. + // Deve ser uma referência ao nome da função, não à chamada da função. + elem.onblur = doEvent; +}; + +function doEvent() +{ + elem.value = 'Tchauzinho'; + console.log("Evento onblur detectado!") +} +</script> + +<style type="text/css"> +<!-- +#foo { +border: solid blue 2px; +} +--> +</style> +</head> + +<body onload="initElement();"> +<form> +<input type="text" id="foo" value="Olá!" /> +</form> + +<p>Clique no elemento acima para dá-lo focus, depois clique fora do elemento.<br /> Recarregue a pagina através do NavBar.</p> + +</body> +</html> +</pre> + +<h2 id="Notas">Notas</h2> + +<p>O evento blur aparece quando um elemento perde o focus.</p> + +<p>Em contraste cp, MSIE--O qual faz quase todos os elementos receberem o evento blur--quase todos os elementos em navegadores baseados no Gecko NÃO funcionam com este evento.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onblur','onblur')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> diff --git a/files/pt-br/web/api/globaleventhandlers/onchange/index.html b/files/pt-br/web/api/globaleventhandlers/onchange/index.html new file mode 100644 index 0000000000..c2dab3f1d8 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onchange/index.html @@ -0,0 +1,46 @@ +--- +title: GlobalEventHandlers.onchange +slug: Web/API/GlobalEventHandlers/onchange +tags: + - API + - HTML DOM + - Propriedade + - Referencia +translation_of: Web/API/GlobalEventHandlers/onchange +--- +<div> +<div>{{ ApiRef("HTML DOM") }}</div> +</div> + +<p>A propriedade <code>onchange</code> determina e retorna o <a href="/docs/Web/Guide/Events/Event_handlers" title="/en-US/docs/Web/Guide/DOM/Events/Event_handlers">manipulador de eventos</a> para o evento {{event("change")}}.</p> + +<h2 id="Syntax" name="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em><var>element</var></em>.onchange = <em>handlerFunction</em>; +var <em>handlerFunction</em> = <em><var>element</var></em>.onchange; +</pre> + +<p><code><em>handlerFunction</em></code> deve ser ou <code>null</code> ou uma <a href="/en-US/docs/Web/JavaScript/Reference/Functions" title="/en-US/docs/JavaScript/Reference/Functions_and_function_scope">função JavaScript</a> especificando o manipulador para o evento.</p> + +<h2 id="Notes" name="Notes">Notas</h2> + +<p>Veja a página do <a href="/en-US/docs/Web/Guide/Events/Event_handlers" title="/en-US/docs/Web/Guide/DOM/Events/Event_handlers">manipulador de eventos do DOM</a> para informações sobre como trabalhar com manipuladores <code>on...</code> </p> + +<p>Veja a documentação do evento {{event("change")}} para informações sobre o evento.</p> + +<h2 id="Specification" name="Specification">Especificação</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentários</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onchange','onchange')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> diff --git a/files/pt-br/web/api/globaleventhandlers/onclick/index.html b/files/pt-br/web/api/globaleventhandlers/onclick/index.html new file mode 100644 index 0000000000..ea91496ac9 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onclick/index.html @@ -0,0 +1,83 @@ +--- +title: GlobalEventHandlers.onclick +slug: Web/API/GlobalEventHandlers/onclick +translation_of: Web/API/GlobalEventHandlers/onclick +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<p>A propriedade <code><strong>onclick</strong></code> do mixin {{domxref("GlobalEventHandlers")}} é o {{domxref("EventHandler")}} para o processamento de eventos de {{event("click")}} em um dado elemento.</p> + +<p>O evento <code>click</code> acontece quando o usuário clica em um elemento. É disparado após os eventos {{event("mousedown")}} e{{event("mouseup")}} na respectiva ordem.</p> + +<div class="note"><strong>Note:</strong> Ao usar o evento <code>click</code> para disparar uma ação, considere também adicionar essa mesma ação ao evento {{event("keydown")}}, para permitir o uso dessa mesma ação a pessoas que não usam um mouse ou uma touchscreen.</div> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox"><var>elemento</var>.onclick = <em>refDeFuncao</em>; +</pre> + +<h3 id="Value">Value</h3> + +<p><code>refDeFuncao</code> é o nome de uma função ou uma <a href="/pt-BR/docs/Web/JavaScript/Reference/Operators/function">expressão de função</a>. Essa função recebe um objeto {{domxref("MouseEvent")}} como único argumento. Dentro da função, <code><a href="/pt-BR/docs/Web/JavaScript/Reference/Operators/this">this</a></code> será o elemento de qual o evento foi disparado.</p> + +<p>Apenas um manipulador <code>onclick</code> pode estar associado a um objeto em um momento. Em vez disso, você talvez prefira usar o método {{domxref("EventTarget.addEventListener()")}}, já que ele é mais flexível.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<p>Esse evento registra a posição dos cliques.</p> + +<h3 id="HTML">HTML</h3> + +<pre class="brush:html"><p>Clique em qualquer lugar nesse exemplo.</p> +<p id="log"></p></pre> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js">let log = document.getElementById('log'); + +document.onclick = inputChange; + +function inputChange(e) { + log.textContent = `Posição: (${e.clientX}, ${e.clientY})`; +}</pre> + +<h3 id="Result">Result</h3> + +<p>{{EmbedLiveSample("Example")}}</p> + +<h2 id="Especificação">Especificação</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onclick','onclick')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_Navegador">Compatibilidade de Navegador</h2> + +<div> + + +<p>{{Compat("api.GlobalEventHandlers.onclick")}}</p> +</div> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{event("click")}} event</li> + <li>Manipuladores de evento relacionados: + <ul> + <li>{{domxref("GlobalEventHandlers.onauxclick")}}</li> + <li>{{domxref("GlobalEventHandlers.ondblclick")}}</li> + </ul> + </li> +</ul> diff --git a/files/pt-br/web/api/globaleventhandlers/oncontextmenu/index.html b/files/pt-br/web/api/globaleventhandlers/oncontextmenu/index.html new file mode 100644 index 0000000000..5649c6671f --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/oncontextmenu/index.html @@ -0,0 +1,48 @@ +--- +title: GlobalEventHandlers.oncontextmenu +slug: Web/API/GlobalEventHandlers/oncontextmenu +tags: + - API + - HTML DOM + - Propriedade + - Referencia +translation_of: Web/API/GlobalEventHandlers/oncontextmenu +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<p>Um uma propriedade do manipulador de eventos da janela para eventos com o botão direito do mouse. A menos que o comportamento padrão do navegador seja bloqueado (veja exemplos abaixo sobre como fazer isso), o menu de contexto do navegador irá ser ativado (apesar do IE8 ter um bug com ele e não irá ativar o menu de contexto se o manipulador de eventos contextmenu for definido). Note que este evento irá acontecer com qualquer evento não-desabilitado do botão direito do mouse e não depende de um elemento que contenha o <a href="http://hacks.mozilla.org/2011/11/html5-context-menus-in-firefox-screencast-and-code/" title="http://hacks.mozilla.org/2011/11/html5-context-menus-in-firefox-screencast-and-code/">atributo "contextmenu"</a>.</p> + +<h2 id="Syntax" name="Syntax">Sintaxe</h2> + +<pre class="syntaxbox">window.oncontextmenu = funcRef; +//funcRef se refere à função a ser chamada</pre> + +<h2 id="Example" name="Example">Exemplo</h2> + +<p>Os exemplos abaixo irão desabilitar o clique com botão direito na página:</p> + +<pre class="brush:js;">document.oncontextmenu = function () { // Usa o document ao invés de window para compatibilidade com o IE8 + return false; +}; + +window.addEventListener('contextmenu', function (e) { // Não compatível com IE < 9 + e.preventDefault(); +}, false); +</pre> + +<h2 id="Specifications" name="Specifications">Especificações</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-oncontextmenu','oncontextmenu')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> diff --git a/files/pt-br/web/api/globaleventhandlers/onerror/index.html b/files/pt-br/web/api/globaleventhandlers/onerror/index.html new file mode 100644 index 0000000000..95fdc08ce3 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onerror/index.html @@ -0,0 +1,97 @@ +--- +title: GlobalEventHandlers.onerror +slug: Web/API/GlobalEventHandlers/onerror +tags: + - API + - HTML DOM + - Propriedade + - Referencia +translation_of: Web/API/GlobalEventHandlers/onerror +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>Um <a href="/en-US/docs/Web/Guide/Events/Event_handlers">event handler</a> para o evento <code><a href="/en-US/docs/Web/Events/error">error</a></code> . Eventos de erro são disparados contra diversos tipos de alvos, para diferentes tipos de erros: </p> + +<ul> + <li>Quando um <strong>erro de execução (runtime error) de JavaScript</strong> (incluindo erros de sintaxe) ocorrem, um evento <code><a href="/en-US/docs/Web/Events/error">error</a></code> usando a interface {{domxref("ErrorEvent")}} é disparado no {{domxref("window")}} e <code>window.onerror()</code> é invocado.</li> + <li>Quando um recurso (como um {{HTMLElement("img")}} ou {{HTMLElement("script")}}) <strong>falha na inicialização</strong>, um evento <code><a href="/en-US/docs/Web/Events/error">error</a></code> usando a interface {{domxref("Event")}} é disparado no elemento , que inicializa o load e o <code>onerror()</code> handler do elemento é invocado. Esse evento de erro emergem para a janela, mas (pelo menos no Firefox) pode ser manipulado com uma captura única {{domxref("window.addEventListener")}}.</li> +</ul> + +<p>Instalando um manipulador de eventos de erro global é útil para compilação automatizada de relatórios de erro. </p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<p>Por questões históricas, diferentes argumentos são passados para os manipuladores window.onerror e element.onerror;</p> + +<h3 id="window.onerror">window.onerror</h3> + +<pre class="brush: js">window.onerror = function(message, source, lineno, colno, error) { ... } +</pre> + +<p>Parâmetros da função:</p> + +<ul> + <li><code>message</code>: mensagem de erro (string). Disponível como <code>event</code> (sic!) no manipulador HTML <code>onerror=""</code> .</li> + <li><code>source</code>: URL do script onde o erro foi disparado(string)</li> + <li><code>lineno</code>: Número da linha onde o evento foi disparado (number)</li> + <li><code>colno</code>: Número da coluna para a linha onde o evento ocorreu (number) {{gecko_minversion_inline("31.0")}}</li> + <li><code>error</code>: <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error Object</a> (object) {{gecko_minversion_inline("31.0")}}</li> +</ul> + +<p> </p> + +<p>Quando a função retorna verdadeira, ela evita o disparo do manipulador de evento padrão </p> + +<h3 id="element.onerror">element.onerror</h3> + +<pre class="brush: js">element.onerror = function(event) { ... } +</pre> + +<p><code>element.onerror</code> aceita uma função dom um único argumento do tipo {{domxref("Event")}}.</p> + +<h2 id="Notas">Notas</h2> + +<p>Quando um erro de sintaxe<strong>(?)</strong> ocorre em um script, carregado de uma <a href="/en-US/docs/Web/Security/Same-origin_policy">origem diferente</a>, os detalhes do erro de sintaxe não são reportados para previnir vazamento de informações (veja {{bug("363897")}}). Ao invés de exibir simplesmente <code><strong>"Script error." (erro de script)</strong></code>, este comportamento pode ser sobrescrito em alguns navegadores usando o atributo <code>{{htmlattrxref("crossorigin","script")}}</code> no {{HTMLElement("script")}} e tendo o servidor enviado os cabeçalhos HTTP CORS apropriados. Uma solução alternativa é isolar o "Script error." e manipulá-lo sabendo que o detalhe do erro é visível somente no console do navegador e não acessível através do JavaScript.</p> + +<pre class="brush: js">window.onerror = function (msg, url, lineNo, columnNo, error) { + var string = msg.toLowerCase(); + var substring = "script error"; + if (string.indexOf(substring) > -1){ + alert('Script Error: See Browser Console for Detail'); + } else { + alert(msg, url, lineNo, columnNo, error); + } + return false; +};</pre> + +<p>Quando usamos a marcação HTML inline (<code><body onerror="alert('an error occurred')"></code>), a especificação HTML requer argumentos passados para o <code>onerror</code> identificados como <code>event</code>, <code>source</code>, <code>lineno</code>, <code>colno</code>, <code>error</code>. Os navegadors que não implementam este requerimento, podem ainda serem obtidos por <code>arguments[0]</code> até <code>arguments[2]</code>.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onerror','onerror')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_navegadores">Compatibilidade de navegadores</h2> + +<p>Antes do Firefox 14, quando um {{HTMLElement("script")}} falhava na inicialização, <code>window.onerror</code> era invocada com a mensagem <strong>"Error loading script"(erro de leitura de script)</strong>. Isto foi corrigido no {{bug("737087")}}, agora <code>scriptElement.onerror</code> é chamado ao invés disto.</p> + +<p>Desde o Firefox 31, os últimos 2 argumentos (<code>colno</code> and <code>error</code>) foram adicionados, o que significa que você tem acesso a pilha de rastreamento de um erro de script através do <code>window.onerror</code> por intermédio do <code>Error</code> object ({{bug("355430")}}.)</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><a href="http://blog.getsentry.com/2016/01/04/client-javascript-reporting-window-onerror.html">Capture e reporte erros JavaScript com window.onerror (blog.getsentry.com, 2016)</a></li> + <li><a href="https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/">Como capturar erros JavaScript com window.onerror (mesmo no Chrome ou Firefox) (danlimerick.wordpress.com, 2014)</a></li> +</ul> diff --git a/files/pt-br/web/api/globaleventhandlers/onfocus/index.html b/files/pt-br/web/api/globaleventhandlers/onfocus/index.html new file mode 100644 index 0000000000..3d27899ec3 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onfocus/index.html @@ -0,0 +1,36 @@ +--- +title: GlobalEventHandlers.onfocus +slug: Web/API/GlobalEventHandlers/onfocus +translation_of: Web/API/GlobalEventHandlers/onfocus +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>A propriedade <strong>onfocus</strong> retorna o código de manipulador de eventos <em>onFocus</em> no elemento atual.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox">element.onfocus = <em>código de manipulação de eventos</em> +</pre> + +<h2 id="Notas">Notas</h2> + +<p>O evento <em>Focus </em>é gerado quando o usuario define o foco no elemento.</p> + +<p>Oposta à MSIE, em que quase todos os tipos de elementos recebem o evento <em>focus</em>, em navegadores Gecko quase todos os tipos de elementos não funcionam com este evento.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">especificaçãos</th> + <th scope="col">Status</th> + <th scope="col">Comentario</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onfocus','onfocus')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> diff --git a/files/pt-br/web/api/globaleventhandlers/onkeyup/index.html b/files/pt-br/web/api/globaleventhandlers/onkeyup/index.html new file mode 100644 index 0000000000..394aa886b2 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onkeyup/index.html @@ -0,0 +1,61 @@ +--- +title: GlobalEventHandlers.onkeyup +slug: Web/API/GlobalEventHandlers/onkeyup +tags: + - API + - HTML DOM + - Propriedade + - Referencia +translation_of: Web/API/GlobalEventHandlers/onkeyup +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>A propriedade<strong> onkeyup</strong> retorna o código de manipulador de eventos onKeyUp no elemento atual.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox">element.onkeyup = <em>código do manipulador do evento</em>s +</pre> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: js"> <input type="text" onKeyUp="teclaPressionada(event)"> + <script> + function teclaPressionada(evt) { + console.log(evt.keyCode) + } + </script> +</pre> + +<h2 id="Notas">Notas</h2> + +<p>O evento keyup é iniciado quando o usuário libera a tecla é pressionada.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onkeyup','onkeyup')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade">Compatibilidade</h2> + +<article> +<div class="hidden"> +<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>and send us a pull request.</p> +</div> + +<p>{{Compat("api.GlobalEventHandlers.onkeyup")}}</p> +</article> + +<div id="compat-mobile"> </div> diff --git a/files/pt-br/web/api/globaleventhandlers/onload/index.html b/files/pt-br/web/api/globaleventhandlers/onload/index.html new file mode 100644 index 0000000000..2de2fb11c4 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onload/index.html @@ -0,0 +1,74 @@ +--- +title: GlobalEventHandlers.onload +slug: Web/API/GlobalEventHandlers/onload +translation_of: Web/API/GlobalEventHandlers/onload +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>Um manipulador de eventos para o evento de carregamento do objeto {{domxref("window")}}.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="eval">window.onload = <em>funcRef</em>; +</pre> + +<ul> + <li><code>funcRef é a função do manipulador a ser chamada quando o evento de carregamento do objeto </code>{{domxref("window")}} <code>dispara.</code></li> +</ul> + +<h2 id="Exemplos">Exemplos</h2> + +<pre class="brush: js">window.onload = function() { + init(); + doSomethingElse(); +}; +</pre> + +<pre class="brush: html"><!doctype html> +<html> + <head> + <title>onload test</title> + <script> + function load() { + console.log("Evento de carregamento detectado!"); + } + window.onload = load; + </script> + </head> + <body> + <p>O evento de carregamento dispara quando o documento acabou de ser carregado!</p> + </body> +</html> +</pre> + +<h2 id="Notas">Notas</h2> + +<p>O evento de carregamento dispara no final do processo de carregamento do documento. Neste ponto, todos os objetos do documento estão no DOM, e todas as imagens, scripts, links e sub-frames terminaram de carregar.</p> + +<p>Existe também os <a href="/en-US/docs/Web/Events">Gecko-Specific DOM Events</a>, como o <code>DOMContentLoaded </code>e o <code>DOMFrameContentLoaded</code> (que pode ser manipulado utilizando o {{domxref("EventTarget.addEventListener()")}}) que são disparados após o DOM para a página ser construído, mas não espera outros recursos serem carregados.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("HTML WHATWG", "webappapis.html#handler-onload", "onload")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td>Definição inicial</td> + </tr> + </tbody> +</table> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><code>DOMContentLoaded</code> event em <a href="/en-US/docs/Listening_to_events_in_Firefox_extensions#Simple_DOM_events">Listening to events: Simple DOM events</a></li> + <li>IIEF <a href="https://en.wikipedia.org/wiki/Immediately-invoked_function_expression" rel="nofollow noreferrer">Immediately-invoked function expression</a></li> +</ul> diff --git a/files/pt-br/web/api/globaleventhandlers/onlostpointercapture/index.html b/files/pt-br/web/api/globaleventhandlers/onlostpointercapture/index.html new file mode 100644 index 0000000000..8df6a32e69 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onlostpointercapture/index.html @@ -0,0 +1,70 @@ +--- +title: GlobalEventHandlers.onlostpointercapture +slug: Web/API/GlobalEventHandlers/onlostpointercapture +tags: + - API + - DOM + - Event Handler + - GlobalEventHandlers + - HTML + - Propriedade + - Referencia + - events + - onlostpointercapture +translation_of: Web/API/GlobalEventHandlers/onlostpointercapture +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>A propriedade <strong><code>onlostpointercapture</code></strong> do mixin {{domxref("GlobalEventHandlers")}} é uma {{domxref("EventHandler")}} que processa eventos {{event("lostpointercapture")}}.</p> + +<h2 id="Syntax" name="Syntax">Sintaxe</h2> + +<pre class="syntaxbox"><em>target</em>.onlostpointercapture = <em>functionRef</em>;</pre> + +<h3 id="Value">Value</h3> + +<p><code>functionRef</code> é o nome de uma função ou uma <a href="/pt-BR/docs/Web/JavaScript/Reference/Operators/function">expressão de função</a>. A função recebe um objeto {{domxref("PointerEvent")}} como seu único argumento.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: js">function overHandler(event) { + // Determinar o manipulador lostpointercapture para o evento alvo (<em>target event</em>). + let lostCaptureHandler = event.target.onlostpointercapture; +} + +function init() { + let el = document.getElementById('target'); + el.onlostpointercapture = overHandler; +} +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('Pointer Events 2', '#the-lostpointercapture-event', 'onlostpointercapture')}}</td> + <td>{{Spec2('Pointer Events 2')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_Navegador">Compatibilidade de Navegador</h2> + + + +<p>{{Compat("api.GlobalEventHandlers.onlostpointercapture")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>Evento <code><a href="/pt-BR/docs/Web/API/Document/lostpointercapture_event">Document: lostpointercapture</a></code></li> + <li>Evento <code><a href="/pt-BR/docs/Web/API/HTMLElement/lostpointercapture_event">HTMLElement: lostpointercapture</a></code></li> + <li>{{domxref("Element.releasePointerCapture()")}}</li> +</ul> diff --git a/files/pt-br/web/api/globaleventhandlers/onscroll/index.html b/files/pt-br/web/api/globaleventhandlers/onscroll/index.html new file mode 100644 index 0000000000..1156bfb2f7 --- /dev/null +++ b/files/pt-br/web/api/globaleventhandlers/onscroll/index.html @@ -0,0 +1,94 @@ +--- +title: GlobalEventHandlers.onscroll +slug: Web/API/GlobalEventHandlers/onscroll +translation_of: Web/API/GlobalEventHandlers/onscroll +--- +<div>{{ApiRef("HTML DOM")}}</div> + +<p>A propriedade <strong><code>onscroll</code></strong> do {{domxref("GlobalEventHandlers")}} é uma mistura de eventos {{domxref("EventHandler")}} que processam eventos <code>scroll</code>.</p> + +<p>O evento <code>scroll</code> é disparado quando uma visão do documento ou um elemento foi rolado, seja por um usuário, uma <a href="/en-US/docs/Web/API">API Web</a>, ou o {{glossary("user agent")}}.</p> + +<div class="blockIndicator note"> +<p><strong>Nota:</strong> Não confunda <code>onscroll</code> com {{domxref("GlobalEventHandlers.onwheel", "onwheel")}}: <code>onwheel</code> manipula a rotação da roda do mouse, enquanto <code>onscroll</code> manipula rolagem do conteúdo do objeto.</p> +</div> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox"><em>target</em>.onscroll = <em>functionRef</em>; +</pre> + +<h3 id="Valor">Valor</h3> + +<p><code>functionRef</code> é o nome de uma função ou uma <a href="/en-US/docs/Web/JavaScript/Reference/Operators/function">expressão de função</a>. A função recebe um {{domxref("UIEvent")}} objeto com um único argumento.</p> + +<p>Apenas um manipulador <code>onscroll</code> pode ser associado à um objeto por vez. Para uma maior flexibilidade, você pode passar um {{event("scroll")}} evento para o {{domxref("EventTarget.addEventListener()")}} metódo ao invés disso.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<p>Este exemplo monitora rolagens sobre o elemento {{HtmlElement("textarea")}}, e registra a posição vertical adequadamente.</p> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><textarea>1 2 3 4 5 6 7 8 9</textarea> +<p id="log"></p></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css">textarea { + width: 4rem; + height: 8rem; + font-size: 3rem; +}</pre> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js">const textarea = document.querySelector('textarea'); +const log = document.getElementById('log'); + +textarea.onscroll = logScroll; + +function logScroll(e) { + log.textContent = `Posição do scroll: ${e.target.scrollTop}`; +}</pre> + +<h3 id="Resultado">Resultado</h3> + +<p>{{EmbedLiveSample("Exemplo", 700, 200)}}</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG','#handler-onscroll','onscroll')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName("DOM3 Events", "#event-type-scroll", "onscroll")}}</td> + <td>{{Spec2("DOM3 Events")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_com_o_Navegador">Compatibilidade com o Navegador</h2> + + + +<p>{{Compat("api.GlobalEventHandlers.onscroll")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Document/scroll_event">Document: evento <code>scroll</code></a></li> + <li><a href="/en-US/docs/Web/API/Element/scroll_event">Element: evento <code>scroll</code></a></li> +</ul> |