Skip to content
  • ch.dumez@sisa.samsung.com's avatar
    compareDocumentPosition() should report PRECEDING or FOLLOWING information... · 072d9592
    ch.dumez@sisa.samsung.com authored
    compareDocumentPosition() should report PRECEDING or FOLLOWING information even if nodes are disconnected
    https://bugs.webkit.org/show_bug.cgi?id=119316
    
    Reviewed by Ryosuke Niwa.
    
    Source/WebCore:
    
    As per the latest specification, compareDocumentPosition() should report PRECEDING or FOLLOWING
    information even if nodes are disconnected:
    - http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
    
    This behavior is consistent with both IE10, Firefox 22 and since recently Blink.
    
    No new tests, covered by existing tests.
    
    * dom/Node.cpp:
    (WebCore::compareDetachedElementsPosition):
    (WebCore::Node::compareDocumentPosition):
    
    LayoutTests:
    
    Update fast/dom/compare-document-position-disconnected-nodes.html to check that compareDocumentPosition()
    now returns one of the following values for disconnected nodes:
    - DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_PRECEDING
    - DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING
    
    Several dom/xhtml/level3 are skipped and marked as WonfFix because they are outdated and no longer match
    the DOM4 specification. They expect compareDocumentPosition() not to return PRECEDING / FOLLOWING
    information for disconnected nodes.
    
    * TestExpectations:
    * dom/xhtml/level3/core/nodecomparedocumentposition38-expected.txt:
    * fast/dom/compare-document-position-disconnected-nodes-expected.txt:
    * fast/dom/compare-document-position-disconnected-nodes.html:
    * fast/dom/shadow/compare-document-position-expected.txt:
    * fast/dom/shadow/compare-document-position.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    072d9592