1
- <pre class=' metadata' >
1
+ <pre class=metadata>
2
2
Group : WHATWG
3
3
H1 : DOM
4
4
Shortname : dom
@@ -358,34 +358,24 @@ use of this functionality through <a>events</a>
358
358
(synthetic events) can make use of the return value of the
359
359
{{EventTarget/dispatchEvent()}} method:
360
360
361
- <pre class=' lang-javascript' >
361
+ <pre class=lang-javascript>
362
362
if(obj.dispatchEvent(event)) {
363
363
// event was not canceled, time for some magic
364
364
…
365
365
}
366
366
</pre>
367
367
368
- When an <a>event</a> is
369
- <a>dispatched</a> to an object that
370
- <a>participates</a> in a
371
- <a>tree</a> (e.g. an
372
- <a for="/">element</a> ), it can reach
373
- <a>event listeners</a> on that object's
374
- <a>ancestors</a> too. First all object's
375
- <a>ancestor</a>
376
- <a>event listeners</a> whose
377
- <a for="event listener">capture</a> variable is set to true are invoked, in
378
- <a>tree order</a> . Second, object's own
379
- <a>event listeners</a> are invoked. And
380
- finally, and only if <a>event</a> 's
381
- {{Event/bubbles}} attribute value is true,
382
- object's <a>ancestor</a>
383
- <a>event listeners</a> are invoked again,
384
- but now in reverse <a>tree order</a> .
385
-
386
- Let's look at an example of how <a>events</a> work in a <a>tree</a> :
387
-
388
- <pre class='lang-markup'>
368
+ <p> When an <a>event</a> is <a>dispatched</a> to an object that <a>participates</a> in a <a>tree</a>
369
+ (e.g., an <a for=/>element</a> ), it can reach <a>event listeners</a> on that object's
370
+ <a>ancestors</a> too. Effectively, all the object's <a>inclusive ancestor</a> <a>event listeners</a>
371
+ whose <a for="event listener">capture</a> is true are invoked, in <a>tree order</a> . And then, if
372
+ <a>event</a> 's {{Event/bubbles}} is true, all the object' s <a>inclusive ancestor</a>
373
+ <a>event listeners</a> whose <a for="event listener">capture</a> is false are invoked, now in
374
+ reverse <a>tree order</a> .
375
+
376
+ <p> Let's look at an example of how <a>events</a> work in a <a>tree</a> :
377
+
378
+ <pre class=lang-markup>
389
379
<!doctype html>
390
380
<html>
391
381
<head>
@@ -406,19 +396,13 @@ Let's look at an example of how <a>events</a> work in a <a>tree</a>:
406
396
</html>
407
397
</pre>
408
398
409
- The <code> debug</code> function will be invoked twice. Each time the <a>event</a> 's
410
- {{Event/target}} attribute value will be the
411
- <code> span</code> <a for="/">element</a> . The
412
- first time {{Event/currentTarget}} attribute's
413
- value will be the <a>document</a> , the second
414
- time the <code> body</code> <a for="/">element</a> .
415
- {{Event/eventPhase}} attribute's value
416
- switches from {{Event/CAPTURING_PHASE}}
417
- to {{Event/BUBBLING_PHASE}} . If an
418
- <a>event listener</a> was registered for
419
- the <code> span</code> <a for="/">element</a> ,
420
- {{Event/eventPhase}} attribute's value
421
- would have been {{Event/AT_TARGET}} .
399
+ <p> The <code> debug</code> function will be invoked twice. Each time the <a>event</a> 's
400
+ {{Event/target}} attribute value will be the <code> span</code> <a for=/>element</a> . The first time
401
+ {{Event/currentTarget}} attribute's value will be the <a>document</a> , the second time the
402
+ <code> body</code> <a for=/>element</a> . {{Event/eventPhase}} attribute's value switches from
403
+ {{Event/CAPTURING_PHASE}} to {{Event/BUBBLING_PHASE}} . If an <a>event listener</a> was registered
404
+ for the <code> span</code> <a for=/>element</a> , {{Event/eventPhase}} attribute's value would have
405
+ been {{Event/AT_TARGET}} .
422
406
423
407
424
408
<h3 id=interface-event>Interface {{Event}}</h3>
@@ -1959,7 +1943,7 @@ applications.
1959
1943
1960
1944
To illustrate, consider this HTML document:
1961
1945
1962
- <pre class=' lang-markup' >
1946
+ <pre class=lang-markup>
1963
1947
<!DOCTYPE html>
1964
1948
<html class=e>
1965
1949
<head><title>Aliens?</title></head>
@@ -4480,7 +4464,7 @@ when invoked, must run these steps:
4480
4464
4481
4465
<p class="note no-backref"> Whether to return {{Node/DOCUMENT_POSITION_PRECEDING}} or
4482
4466
{{Node/DOCUMENT_POSITION_FOLLOWING}} is typically implemented via pointer comparison. In
4483
- JavaScript implementations a cached <code class=' lang-javascript' > Math.random()</code> value can
4467
+ JavaScript implementations a cached <code class=lang-javascript> Math.random()</code> value can
4484
4468
be used.
4485
4469
4486
4470
<li><p> If <var> node1</var> is an <a>ancestor</a> of <var> node2</var> and <var> attr1</var> is null,
@@ -5001,7 +4985,7 @@ method, when invoked, must return the
5001
4985
<a>list of elements with qualified name <var>qualifiedName</var></a> for <a>this</a> .
5002
4986
5003
4987
<p class="note no-backref"> Thus, in an <a>HTML document</a> ,
5004
- <code class=' lang-javascript' > document.getElementsByTagName("FOO")</code> will match
4988
+ <code class=lang-javascript> document.getElementsByTagName("FOO")</code> will match
5005
4989
<code> <FOO></code> elements that are not in the
5006
4990
<a>HTML namespace</a> , and <code> <foo></code> elements that are in
5007
4991
the <a>HTML namespace</a> , but not <code> <FOO></code> elements
@@ -7464,9 +7448,9 @@ are <a>boundary points</a>. A <a>boundary point</a> is a <a for=/>tuple</a> cons
7464
7448
<ul class="domTree">
7465
7449
<li class="t1"> {{Element}} : <code> p</code>
7466
7450
<ul>
7467
- <li class="t1"> {{Element}} : <code class=' lang-markup' > <img src="insanity-wolf" alt="Little-endian BOM; decode as big-endian!"></code>
7451
+ <li class="t1"> {{Element}} : <code class=lang-markup> <img src="insanity-wolf" alt="Little-endian BOM; decode as big-endian!"></code>
7468
7452
<li class="t3"> {{Text}} : <span> CSS 2.1 syndata is </span>
7469
- <li class="t1"> {{Element}} : <code class=' lang-markup' > <em></code>
7453
+ <li class="t1"> {{Element}} : <code class=lang-markup> <em></code>
7470
7454
<ul>
7471
7455
<li class="t3"> {{Text}} : <span> awesome</span>
7472
7456
</ul>
@@ -7482,7 +7466,7 @@ are <a>boundary points</a>. A <a>boundary point</a> is a <a for=/>tuple</a> cons
7482
7466
<var ignore> em</var> to the <code> em</code>
7483
7467
<a for="/">element</a> , this would be done as follows:
7484
7468
7485
- <pre class=' lang-javascript' ><code>
7469
+ <pre class=lang-javascript><code>
7486
7470
var range = new Range(),
7487
7471
firstText = p.childNodes[1] ,
7488
7472
secondText = em.firstChild
@@ -10122,6 +10106,7 @@ Justin Summerlin,
10122
10106
Kagami Sascha Rosylight,
10123
10107
呂康豪 (Kang-Hao Lu),
10124
10108
田村健人 (Kent TAMURA),
10109
+ Kevin J. Sung,
10125
10110
Kevin Sweeney,
10126
10111
Kirill Topolyan,
10127
10112
Koji Ishii,
0 commit comments