Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7081,7 +7081,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
// inherits <span data-x="dom-HTMLCollection-length">length</span> and 'getter'
<span>Element</span>? <span data-x="dom-HTMLAllCollection-item">item</span>(unsigned long index);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, these are a pretty big mess too. The comment says you inherit the "getter" but how does that even work. And item is shadowed by two overloads, but doesn't have a comment, even though namedItem does. So confusing.

I guess not any different than before though, so it doesn't need to be addressed in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems what Gecko does here is just have a distinct class for this collection. We could do that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm same in Chrome. Edge inherits from HTMLCollection though. Interesting.

(<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-item-string">item</span>(DOMString name);
legacycaller getter (<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited namedItem()
legacycaller getter (<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited <span data-x="dom-HTMLCollection-namedItem">namedItem()</span>
};</pre>

<dl class="domintro">
Expand Down Expand Up @@ -7199,7 +7199,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<pre class="idl">interface <dfn>HTMLFormControlsCollection</dfn> : <span>HTMLCollection</span> {
// inherits <span data-x="dom-HTMLCollection-length">length</span> and <span data-x="dom-HTMLCollection-item">item</span>()
legacycaller getter (<span>RadioNodeList</span> or <span>Element</span>)? <span data-x="dom-HTMLFormControlsCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited namedItem()
getter (<span>RadioNodeList</span> or <span>Element</span>)? <span data-x="dom-HTMLFormControlsCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited <span data-x="dom-HTMLCollection-namedItem">namedItem()</span>
};

interface <dfn>RadioNodeList</dfn> : <span>NodeList</span> {
Expand All @@ -7221,8 +7221,8 @@ interface <dfn>RadioNodeList</dfn> : <span>NodeList</span> {

<dt><var>element</var> = <var>collection</var> . <code subdfn data-x="dom-HTMLFormControlsCollection-namedItem">namedItem</code>(<var>name</var>)</dt>
<dt><var>radioNodeList</var> = <var>collection</var> . <code data-x="dom-HTMLFormControlsCollection-namedItem">namedItem</code>(<var>name</var>)</dt>
<dt><var>collection</var>[<var>name</var>]</dt>
<dt><var>collection</var>(<var>name</var>)</dt>
<dt><var>element</var> = <var>collection</var>[<var>name</var>]</dt>
<dt><var>radioNodeList</var> = <var>collection</var>[<var>name</var>]</dt>
<dd>
<p>Returns the item with <span data-x="concept-id">ID</span> or <code data-x="attr-fe-name">name</code> <var>name</var> from the collection.</p>
<p>If there are multiple matching items, then a <code>RadioNodeList</code> object containing all those elements is returned.</p>
Expand Down Expand Up @@ -7339,9 +7339,8 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
attributes and methods that manipulate that element's descendants.</p>

<pre class="idl">interface <dfn>HTMLOptionsCollection</dfn> : <span>HTMLCollection</span> {
// inherits <span data-x="dom-HTMLCollection-item">item</span>()
attribute unsigned long <span data-x="dom-HTMLOptionsCollection-length">length</span>; // shadows inherited length
<span data-x="dom-HTMLOptionsCollection-namedItem">legacycaller</span> <span>HTMLOptionElement</span>? (DOMString name);
// inherits <span data-x="dom-HTMLCollection-item">item</span>(), <span data-x="dom-HTMLCollection-namedItem">namedItem</span>()
attribute unsigned long <span data-x="dom-HTMLOptionsCollection-length">length</span>; // shadows inherited <span data-x="dom-HTMLCollection-length">length</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken; should be data-x not data-

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

<span data-x="dom-HTMLOptionsCollection-setter">setter</span> void (unsigned long index, <span>HTMLOptionElement</span>? option);
void <span data-x="dom-HTMLOptionsCollection-add">add</span>((<span>HTMLOptionElement</span> or <span>HTMLOptGroupElement</span>) element, optional (<span>HTMLElement</span> or long)? before = null);
void <span data-x="dom-HTMLOptionsCollection-remove">remove</span>(long index);
Expand All @@ -7363,10 +7362,17 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p>Returns the item with index <var>index</var> from the collection. The items are sorted in <span>tree order</span>.</p>
</dd>

<dt><var>collection</var>[<var>index</var>] = <var>element</var></dt>
<dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should update this with a collection[index] = element section, which is currently missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems remove() is missing too. And that it inherits namedItem() is not mentioned, but item() is... Follow up fodder?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. Seems like it'd be nice to fix it while you're there since part of this commit is already fixup work in the non-normative sections.

Alternately you could make this commit entirely about removing legacycaller, and do a follow-up with the non-normative fixes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, will attempt to fix. Are you bothered by the IDL and the non-normative section not being in the same order? I was thinking of fixing that, but it makes the diff harder to read.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't bother me; it seems like the non-normative section is trying to do some sort of logical grouping, which seems fine I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<p>When <var>index</var> is a greater number than the number of items in the collection, adds
new blank <code>option</code> elements in the corresponding container.
<p>When set to null, removes the item at index <var>index</var> from the collection.</p>
<p>When set to an <code>option</code> element, adds or replaces it at index <var>index</var>
from the collection.</p>
</dd>

<dt><var>element</var> = <var>collection</var> . <code subdfn data-x="dom-HTMLOptionsCollection-namedItem">namedItem</code>(<var>name</var>)</dt>
<dt><var>nodeList</var> = <var>collection</var> . <code data-x="dom-HTMLOptionsCollection-namedItem">namedItem</code>(<var>name</var>)</dt>
<dt><var>collection</var>[<var>name</var>]</dt>
<dt><var>collection</var>(<var>name</var>)</dt>
<dt><var>element</var> = <var>collection</var>[<var>name</var>]</dt>
<dd>
<p>Returns the item with <span data-x="concept-id">ID</span> or <code data-x="attr-option-name">name</code> <var>name</var> from the collection.</p>
<p>If there are multiple matching items, then the first is returned.</p>
Expand All @@ -7381,6 +7387,11 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p>This method will throw a <code>HierarchyRequestError</code> exception if <var>element</var> is an ancestor of the element into which it is to be inserted.</p>
</dd>

<dt><var>collection</var> . <code subdfn data-x="dom-HTMLOptionsCollection-remove">remove</code>(<var>index</var>)</dt>
<dd>
<p>Removes the item with index <var>index</var> from the collection.</p>
</dd>

<dt><var>collection</var> . <code subdfn data-x="dom-HTMLOptionsCollection-selectedIndex">selectedIndex</code> [ = <var>value</var> ]</dt>

<dd>
Expand Down Expand Up @@ -7423,11 +7434,6 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..

<p>The properties exposed in this way must be <span>unenumerable</span>.</p>

<p>The <dfn data-x="dom-HTMLOptionsCollection-namedItem">legacy caller</dfn> of the
<code>HTMLOptionsCollection</code> interface must act like the <code
data-x="dom-HTMLCollection-namedItem">namedItem()</code> method on the ancestor
<code>HTMLCollection</code> interface.</p>

<p>When the user agent is to <dfn data-x="dom-HTMLOptionsCollection-setter">set the value of a new
indexed property or set the value of an existing indexed property</dfn> for a given property index
<var>index</var> to a new value <var>value</var>, it must run the following
Expand Down Expand Up @@ -7532,7 +7538,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..

<pre class="idl">interface <dfn>HTMLPropertiesCollection</dfn> : <span>HTMLCollection</span> {
// inherits <span data-x="dom-HTMLCollection-length">length</span> and <span data-x="dom-HTMLCollection-item">item</span>()
getter <span>PropertyNodeList</span>? <span data-x="dom-HTMLPropertiesCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited namedItem()
getter <span>PropertyNodeList</span>? <span data-x="dom-HTMLPropertiesCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited <span data-x="dom-HTMLCollection-namedItem">namedItem()</span>
[SameObject] readonly attribute DOMString[] <span data-x="dom-HTMLPropertiesCollection-names">names</span>;
};

Expand Down