W3C home > Mailing lists > Public > www-style@w3.org > September 2017

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

From: Sangwhan Moon <sangwhan@iki.fi>
Date: Mon, 11 Sep 2017 15:04:52 +0900
Message-Id: <E529D452-F6F6-4505-946E-81740E56BB3F@iki.fi>
To: "www-style@w3.org" <www-style@w3.org>
Hello www-style,

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.

While canonically it is expected for an ID to be unique, implementations seem to be happy to allow duplicates - would it make sense to at least mention this in the section defining ID selectors? Neither HTML nor DOM seems to explicitly require uniqueness as a conformance requirement, but selectors does.

(Return order for selection against duplicate IDs seem to be logical order on the three implementations I tried,whether this belongs in normative or non-normative is a question that remains to be answered...)

Sangwhan

P.S. I'm not on www-style, so if there is anything that I need to reply back on, please copy me.
(I'm not entirely sure about the reply etiquette on this ML, vaguely guessing Reply-all is frowned upon)
Received on Monday, 11 September 2017 06:05:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:08 UTC