compareDocumentPosition
should allow comparison of elements in the same shadow-including root
#320
Labels
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: shadow
Relates to shadow trees (as defined in DOM)
(Some discussion on this already happened in #309.)
https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
compareDocumentPosition
should be able to compare nodes with different roots if those nodes have the same shadow-including root and the user indicates they would like to compare using the composed tree.Consider:
which composes to something 'like':
A.compareDocumentPosition(B, {composed: true});
, or something similar, should returnDOCUMENT_POSITION_PRECEDING
.A strange situation this brings up is how fallback content of a slot compare to other nodes in the same shadow-including root when that slot has assigned nodes. IMHO, when comparing using the composed tree, the slot's fallback content should be considered disconnected.
Also, given that a ShadowRoot doesn't have a natural position in its host's tree (or relative to its host's descendants - it's not a special child) without composition, I think step 6 in the specced behavior should continue to apply if no explicit opt-in is indicated.
The text was updated successfully, but these errors were encountered: