Re: [selectors4] Behavior undefined for multiple elements sharing the same ID

On Mon, Sep 11, 2017, at 04:04 PM, Sangwhan Moon wrote:
> While dealing with a strange edge case related to duplicated IDs
> (triggered via cloneNode(), but also can be done by poorly written
> markup) I noticed that the selectors spec doesn't define what
> implementations are expected to do when there are multiple elements which
> define the same ID.

The spec makes it pretty clear that all elements with the same ID should
be
matched.

The spec says:
> An ID selector represents an element instance that has an identifier that
> matches the identifier in the ID selector.
and it specifically mentions the case after:
> (It is possible in non-conforming documents for multiple elements to match
> a single ID selector.)

- Xidorn

Received on Monday, 11 September 2017 06:18:14 UTC