Skip to content

Commit 542be55

Browse files
TimothyGuannevk
authored andcommitted
Define document.all as having [[IsHTMLDDA]]
Fixes #3015.
1 parent ae33c29 commit 542be55

File tree

1 file changed

+34
-37
lines changed

1 file changed

+34
-37
lines changed

source

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,6 +3055,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30553055
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects"><code>SharedArrayBuffer</code></dfn> class</li>
30563056
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror"><code>TypeError</code></dfn> class</li>
30573057
<li>The <dfn data-x="js-RangeError" data-x-href="https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror"><code>RangeError</code></dfn> class</li>
3058+
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot">[[IsHTMLDDA]]</dfn> internal slot</li>
30583059
<li>The <dfn data-x="js-typeof" data-x-href="https://tc39.github.io/ecma262/#sec-typeof-operator"><code>typeof</code></dfn> operator</li>
30593060
<li><dfn data-x-href="https://tc39.github.io/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
30603061
</ul>
@@ -7157,15 +7158,43 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
71577158
different (ab)uses of its methods to all end up returning something, and that it can be called as
71587159
a function as an alternative to property access.</p>
71597160

7160-
<p w-nodev>Objects that implement the <code>HTMLAllCollection</code> interface are <span
7161-
data-x="legacy platform object">legacy platform objects</span> with an additonal [[Call]] internal
7162-
method described in the <a href="#HTMLAllCollection-call">section below</a>.</p>
7163-
71647161
<p class="note">All <code>HTMLAllCollection</code> objects are rooted at a <code>Document</code>
71657162
and have a filter that matches all elements, so the elements <span>represented by the
71667163
collection</span> of an <code>HTMLAllCollection</code> object consist of all the descendant
71677164
elements of the root <code>Document</code>.</p>
71687165

7166+
<p w-nodev>Objects that implement the <code>HTMLAllCollection</code> interface are <span
7167+
data-x="legacy platform object">legacy platform objects</span> with an additonal [[Call]] internal
7168+
method described in the <a href="#HTMLAllCollection-call">section below</a>. They also have an
7169+
<span>[[IsHTMLDDA]]</span> internal slot.</p>
7170+
7171+
<div class="note">
7172+
<p>Objects that implement the <code>HTMLAllCollection</code> interface have several unusual
7173+
behaviors, due of the fact that they have an <span>[[IsHTMLDDA]]</span> internal slot:</p>
7174+
7175+
<ul>
7176+
<li><p>The <span data-x="js-ToBoolean">ToBoolean</span> abstract operation in JavaScript returns
7177+
false when given objects implementing the <code>HTMLAllCollection</code> interface.</p></li>
7178+
7179+
<li><p>The <span data-x="js-abstract-equality">Abstract Equality Comparison</span> algorithm,
7180+
when given objects implementing the <code>HTMLAllCollection</code> interface, returns true when
7181+
compared to the <code data-x="">undefined</code> and <code data-x="">null</code> values.
7182+
(Comparisons using the <span data-x="js-strict-equality">Strict Equality Comparison</span>
7183+
algorithm, and Abstract Equality comparisons to other values such as strings or objects, are
7184+
unaffected.)</p></li>
7185+
7186+
<li><p>The <code data-x="js-typeof">typeof</code> operator in JavaScript returns the string
7187+
<code data-x="">"undefined"</code> when applied to objects implementing the
7188+
<code>HTMLAllCollection</code> interface.</p></li>
7189+
</ul>
7190+
7191+
<p>These special behaviors are motivated by a desire for compatibility with two classes of legacy
7192+
content: one that uses the presence of <code data-x="dom-document-all">document.all</code> as a
7193+
way to detect legacy user agents, and one that only supports those legacy user agents and uses
7194+
the <code data-x="dom-document-all">document.all</code> object without testing for its presence
7195+
first. <ref spec=JAVASCRIPT></p>
7196+
</div>
7197+
71697198
<pre class="idl">[Exposed=Window,
71707199
LegacyUnenumerableNamedProperties]
71717200
interface <dfn>HTMLAllCollection</dfn> {
@@ -7174,7 +7203,7 @@ interface <dfn>HTMLAllCollection</dfn> {
71747203
getter (<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-namedItem">namedItem</span>(DOMString name);
71757204
(<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-item">item</span>(optional DOMString nameOrIndex);
71767205

7177-
// Note: HTMLAllCollection objects have a <a href="#HTMLAllCollection-call">custom [[Call]] internal method</a>.
7206+
// Note: HTMLAllCollection objects have a <a href="#HTMLAllCollection-call">custom [[Call]] internal method</a> and an <span>[[IsHTMLDDA]]</span> internal slot.
71787207
};</pre>
71797208

71807209
<dl class="domintro">
@@ -114105,38 +114134,6 @@ interface <dfn>HTMLFontElement</dfn> : <span>HTMLElement</span> {
114105114134
<code>HTMLAllCollection</code> rooted at the <code>Document</code> node, whose filter matches all
114106114135
elements.</p>
114107114136

114108-
<p>The object returned for <code data-x="dom-document-all">all</code> has several unusual
114109-
behaviors:</p>
114110-
114111-
<ul>
114112-
114113-
<li><p>The user agent must act as if the <span data-x="js-ToBoolean">ToBoolean</span> abstract
114114-
operation in JavaScript returns false when given the object returned for <code
114115-
data-x="dom-document-all">all</code>.</p></li>
114116-
114117-
<li><p>The user agent must act as if the <span data-x="js-abstract-equality">Abstract Equality
114118-
Comparison</span> algorithm, when given the object returned for <code
114119-
data-x="dom-document-all">all</code>, returns true when compared to the <code
114120-
data-x="">undefined</code> and <code data-x="">null</code> values. (Comparisons using the <span
114121-
data-x="js-strict-equality">Strict Equality Comparison</span> algorithm, and Abstract Equality
114122-
comparisons to other values such as strings or objects, are unaffected.)</p></li>
114123-
114124-
<li><p>The user agent must act such that the <code data-x="js-typeof">typeof</code> operator in
114125-
JavaScript returns the string <code data-x="">"undefined"</code> when applied to the object
114126-
returned for <code data-x="dom-document-all">all</code>.</p></li>
114127-
114128-
</ul>
114129-
114130-
<p class="note">These requirements are a <span>willful violation</span> of the JavaScript
114131-
specification current at the time of writing. The JavaScript specification
114132-
requires that <span data-x="js-ToBoolean">ToBoolean</span> return true for all objects, and does not have
114133-
provisions for objects acting as if they were <code data-x="">undefined</code> for the purposes of
114134-
certain operators. This violation is motivated by a desire for compatibility with two classes of
114135-
legacy content: one that uses the presence of <code data-x="dom-document-all">document.all</code>
114136-
as a way to detect legacy user agents, and one that only supports those legacy user agents and
114137-
uses the <code data-x="dom-document-all">document.all</code> object without testing for its
114138-
presence first. <ref spec=JAVASCRIPT></p>
114139-
114140114137
<hr>
114141114138

114142114139
<pre class="idl">partial interface <span id="Window-partial">Window</span> {

0 commit comments

Comments
 (0)