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

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