Skip to content

compareDocumentPosition returns incorrect values for detached nodes #777

@robotlovesyou

Description

@robotlovesyou

While implementing a solution for node.compares for #767 I have found that compareDocumentPosition returns incorrect values for detached nodes.

The Dom Standard specifies that nodes from separate document trees should return the result of adding DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and either DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING but the current implementation doesn't include code allowing it to return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC. The WHATWG standard for compareDocumentPosition appears to have evolved somewhat from the DOM Level 3 core spec and I guess the jdsom implementation hasn't kept up.

I'm working on this as part of the solution for #767 but it's turning into a bit of a monster!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions