Permalink
Browse files

Define document.all as having [[IsHTMLDDA]]

Fixes #3015.
  • Loading branch information...
TimothyGu authored and annevk committed Oct 2, 2017
1 parent ae33c29 commit 542be55f0a627460b55a08b7a1914ea05e9b3a3e
Showing with 34 additions and 37 deletions.
  1. +34 −37 source
View
71 source
@@ -3055,6 +3055,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects"><code>SharedArrayBuffer</code></dfn> class</li>
<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>
<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>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot">[[IsHTMLDDA]]</dfn> internal slot</li>
<li>The <dfn data-x="js-typeof" data-x-href="https://tc39.github.io/ecma262/#sec-typeof-operator"><code>typeof</code></dfn> operator</li>
<li><dfn data-x-href="https://tc39.github.io/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
</ul>
@@ -7157,15 +7158,43 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
different (ab)uses of its methods to all end up returning something, and that it can be called as
a function as an alternative to property access.</p>
<p w-nodev>Objects that implement the <code>HTMLAllCollection</code> interface are <span
data-x="legacy platform object">legacy platform objects</span> with an additonal [[Call]] internal
method described in the <a href="#HTMLAllCollection-call">section below</a>.</p>
<p class="note">All <code>HTMLAllCollection</code> objects are rooted at a <code>Document</code>
and have a filter that matches all elements, so the elements <span>represented by the
collection</span> of an <code>HTMLAllCollection</code> object consist of all the descendant
elements of the root <code>Document</code>.</p>
<p w-nodev>Objects that implement the <code>HTMLAllCollection</code> interface are <span
data-x="legacy platform object">legacy platform objects</span> with an additonal [[Call]] internal
method described in the <a href="#HTMLAllCollection-call">section below</a>. They also have an
<span>[[IsHTMLDDA]]</span> internal slot.</p>
<div class="note">
<p>Objects that implement the <code>HTMLAllCollection</code> interface have several unusual
behaviors, due of the fact that they have an <span>[[IsHTMLDDA]]</span> internal slot:</p>
<ul>
<li><p>The <span data-x="js-ToBoolean">ToBoolean</span> abstract operation in JavaScript returns
false when given objects implementing the <code>HTMLAllCollection</code> interface.</p></li>
<li><p>The <span data-x="js-abstract-equality">Abstract Equality Comparison</span> algorithm,
when given objects implementing the <code>HTMLAllCollection</code> interface, returns true when
compared to the <code data-x="">undefined</code> and <code data-x="">null</code> values.
(Comparisons using the <span data-x="js-strict-equality">Strict Equality Comparison</span>
algorithm, and Abstract Equality comparisons to other values such as strings or objects, are
unaffected.)</p></li>
<li><p>The <code data-x="js-typeof">typeof</code> operator in JavaScript returns the string
<code data-x="">"undefined"</code> when applied to objects implementing the
<code>HTMLAllCollection</code> interface.</p></li>
</ul>
<p>These special behaviors are motivated by a desire for compatibility with two classes of legacy
content: one that uses the presence of <code data-x="dom-document-all">document.all</code> as a
way to detect legacy user agents, and one that only supports those legacy user agents and uses
the <code data-x="dom-document-all">document.all</code> object without testing for its presence
first. <ref spec=JAVASCRIPT></p>
</div>
<pre class="idl">[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface <dfn>HTMLAllCollection</dfn> {
@@ -7174,7 +7203,7 @@ interface <dfn>HTMLAllCollection</dfn> {
getter (<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-namedItem">namedItem</span>(DOMString name);
(<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-item">item</span>(optional DOMString nameOrIndex);
// Note: HTMLAllCollection objects have a <a href="#HTMLAllCollection-call">custom [[Call]] internal method</a>.
// Note: HTMLAllCollection objects have a <a href="#HTMLAllCollection-call">custom [[Call]] internal method</a> and an <span>[[IsHTMLDDA]]</span> internal slot.
};</pre>
<dl class="domintro">
@@ -114105,38 +114134,6 @@ interface <dfn>HTMLFontElement</dfn> : <span>HTMLElement</span> {
<code>HTMLAllCollection</code> rooted at the <code>Document</code> node, whose filter matches all
elements.</p>
<p>The object returned for <code data-x="dom-document-all">all</code> has several unusual
behaviors:</p>
<ul>
<li><p>The user agent must act as if the <span data-x="js-ToBoolean">ToBoolean</span> abstract
operation in JavaScript returns false when given the object returned for <code
data-x="dom-document-all">all</code>.</p></li>
<li><p>The user agent must act as if the <span data-x="js-abstract-equality">Abstract Equality
Comparison</span> algorithm, when given the object returned for <code
data-x="dom-document-all">all</code>, returns true when compared to the <code
data-x="">undefined</code> and <code data-x="">null</code> values. (Comparisons using the <span
data-x="js-strict-equality">Strict Equality Comparison</span> algorithm, and Abstract Equality
comparisons to other values such as strings or objects, are unaffected.)</p></li>
<li><p>The user agent must act such that the <code data-x="js-typeof">typeof</code> operator in
JavaScript returns the string <code data-x="">"undefined"</code> when applied to the object
returned for <code data-x="dom-document-all">all</code>.</p></li>
</ul>
<p class="note">These requirements are a <span>willful violation</span> of the JavaScript
specification current at the time of writing. The JavaScript specification
requires that <span data-x="js-ToBoolean">ToBoolean</span> return true for all objects, and does not have
provisions for objects acting as if they were <code data-x="">undefined</code> for the purposes of
certain operators. This violation is motivated by a desire for compatibility with two classes of
legacy content: one that uses the presence of <code data-x="dom-document-all">document.all</code>
as a way to detect legacy user agents, and one that only supports those legacy user agents and
uses the <code data-x="dom-document-all">document.all</code> object without testing for its
presence first. <ref spec=JAVASCRIPT></p>
<hr>
<pre class="idl">partial interface <span id="Window-partial">Window</span> {

0 comments on commit 542be55

Please sign in to comment.