[go: nahoru, domu]

Skip to content

Commit

Permalink
[css-pseudo-4] Switch pseudo() to return instance rather than list. D…
Browse files Browse the repository at this point in the history
…elete list interface since now nothing uses it? #3541 (comment)
  • Loading branch information
fantasai committed Feb 2, 2019
1 parent ac64f6b commit 39faa82
Showing 1 changed file with 8 additions and 40 deletions.
48 changes: 8 additions & 40 deletions css-pseudo-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -891,57 +891,25 @@ Interface CSSPseudoElement</h3>
must be implemented by all instances of <code>CSSPseudoElement</code>
as a conformance requirement of this module.

<h3 id="CSSPseudoElementList-interface">
Interface CSSPseudoElementList</h3>

The <code>CSSPseudoElementList</code> represents an ordered collection
of <code>CSSPseudoElement</code> instances.

<pre class="idl">
[Exposed=Window]
interface CSSPseudoElementList {
readonly attribute unsigned long <a href="#dom-csspseudochildlist-length">length</a>;
CSSPseudoElement <a href="#dom-csspseudochildlist-item">item</a>(unsigned long index);
CSSPseudoElement <a href="#dom-csspseudochildlist-getbytype">getByType</a>(CSSOMString type);
// replies null if no pseudo-element exists for
// the requested type
};
</pre>

The <dfn id="dom-csspseudochildlist-length">length</dfn> attribute
represents the number of <code>CSSPseudoElement</code> in the
collection or zero if it is empty.
The method <dfn id="dom-csspseudochildlist-item">item()</dfn>
is used to retrieve a <code>CSSPseudo</code><code>Element</code> by index.
It takes one parameter being the requested index into the collection.
Its return value is the <code>CSSPseudo</code><code>Element</code>
at the requested index in the collection
or null if that is not a valid index.

The method <dfn id="dom-csspseudochildlist-getbytype">getByType()</dfn>
is used to retrieve a <code>CSSPseudo</code><code>Element</code>
by its type.
Its return value is the <code>CSSPseudo</code><code>Element</code>
in the collection that matches the type
or null if there is no <code>CSSPseudo</code><code>Element</code>
in the collection for that type.

<h3 id="window-interface">
Addition to the <code>Element</code> interface</h3>

A new method is added to the <code>Element</code> interface to retrieve
pseudo-elements created by a given element for a given type:
<pre class="idl">
partial interface Element {
CSSPseudoElementList <a href="#dom-window-getpseudochildren">pseudo</a>(CSSOMString type);
CSSPseudoElement? <a href="#dom-element-pseudo">pseudo</a>(CSSOMString type);
};
</pre>

The <dfn id="dom-element-pseudo"><code>pseudo()</code></dfn> method
is used to retrieve all <code>CSSPseudoElement</code> instances
created by the element <code>elt</code> for the type <code>type</code>.
Its return value is a <code>CSSPseudoElementList</code>,
potentially empty if no pseudo-element exists for the given element and the given type.
is used to retrieve the <code>CSSPseudoElement</code> instance
created by the element of the type matching <code>type</code>.
Its return value is a <code>CSSPseudoElement</code>,
potentially null if no such pseudo-element exists.

Pseudo-elements of unsupported types are considered to simply not exist;
unrecognized <code>type</code> values are not an error.

<h2 id="css2-compat">
Compatibilitiy Syntax</h2>
Expand Down

0 comments on commit 39faa82

Please sign in to comment.