<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>119325</bug_id>
          
          <creation_ts>2013-07-30 23:37:09 -0700</creation_ts>
          <short_desc>compareDocumentPosition() reports an attribute and its content as disconnected</short_desc>
          <delta_ts>2024-03-18 10:15:52 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>913205</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2013-07-30 23:37:09 -0700</bug_when>
    <thetext>Node::compareDocumentPosition() reports an attribute and its content as disconnected.
Instead, the attribute should contain and precede its content.

This is causing the following test case to fail:
LayoutTests/dom/xhtml/level3/core/nodecomparedocumentposition38.xhtml

I investigated the issue a bit and it seems the problem seems to be that Node::inDocument() returns false for the Text node (content) instead of true.

Note that there is already a workaround in place in Node::compareDocumentPositionInternal() that addresses the same issue for Attribute nodes.

See comment in that method:
// Note that we avoid comparing Attr nodes here, since they return false from inDocument() all the time (which seems like a bug).

It is likely we need to extend the workaround to Text nodes or fix the underlying problem (have inDocument() return correct values for Attr and Text nodes).

Specification:
http://dom.spec.whatwg.org/#dom-node-comparedocumentposition

Corresponding Blink bug:
http://code.google.com/p/chromium/issues/detail?id=264138</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>913207</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2013-07-30 23:39:16 -0700</bug_when>
    <thetext>As explained by Adam in http://code.google.com/p/chromium/issues/detail?id=264138#c1, Attr should no longer be a Node according to the latest specification. It should be its own interface [1].

If we followed the spec, the bug would disappear.

[1] http://dom.spec.whatwg.org/#attr</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2021668</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-03-17 15:30:35 -0700</bug_when>
    <thetext>Safari is passing all WPT tests:

https://wpt.fyi/results/dom/nodes/Node-compareDocumentPosition.html?label=master&amp;label=experimental&amp;aligned=

Chris - Do we need to anything here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2021797</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2024-03-18 10:15:52 -0700</bug_when>
    <thetext>Looks like this bug has been fixed by now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>