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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28097</bug_id>
          
          <creation_ts>2015-02-25 02:28:50 +0000</creation_ts>
          <short_desc>surroundContents should check host-inclusive</short_desc>
          <delta_ts>2018-03-22 18:02:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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="Koji Ishii">kojiishi</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>adamk</cc>
    
    <cc>ayg</cc>
    
    <cc>kojiishi</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>118145</commentid>
    <comment_count>0</comment_count>
    <who name="Koji Ishii">kojiishi</who>
    <bug_when>2015-02-25 02:28:50 +0000</bug_when>
    <thetext>Range.surroundContents() method[1] checks &quot;partially-contained&quot;[2] pre-check without using host-inclusive, but then in later step when to append[3], its pre-check is host-inclusive.

This should be consistent.

Propose to change &quot;partially contained&quot; to use &quot;host-including inclusive ancestor&quot;.

[1] http://w3c.github.io/dom/#dom-range-surroundcontents
    https://dom.spec.whatwg.org/#dom-range-surroundcontents
[2] http://w3c.github.io/dom/#partially-contained
    https://dom.spec.whatwg.org/#dom-range-surroundcontents
[3] http://w3c.github.io/dom/#concept-node-append
    https://dom.spec.whatwg.org/#concept-node-append
[4] http://w3c.github.io/dom/#partially-contained
    https://dom.spec.whatwg.org/#partially-contained</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118160</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-02-25 13:40:01 +0000</bug_when>
    <thetext>As far as I can tell you hit the host-including check as part of the insertion operation of step 5.

The problematic scenario appears to be that you have a range that contains a &lt;template&gt; and that &lt;template&gt; contains a node that you use as newParent argument.

That would argue for a new step I think, as step 1 does not care about newParent.


Also, how can newParent ever be a Text, Comment, or ProcessingInstruction node? Is that for when the range is collapsed? But if it&apos;s not collapsed it seems those nodes would be problematic...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122628</commentid>
    <comment_count>2</comment_count>
    <who name="Koji Ishii">kojiishi</who>
    <bug_when>2015-08-17 05:34:00 +0000</bug_when>
    <thetext>&gt; As far as I can tell you hit the host-including check as part of the insertion operation of step 5.

Right, and in step 4, the spec &quot;replace all with null within newParent&quot;, so failing in step 5 means that UA deletes all children of newParent.

Shouldn&apos;t we fail in step 1 instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122629</commentid>
    <comment_count>3</comment_count>
    <who name="Koji Ishii">kojiishi</who>
    <bug_when>2015-08-17 05:36:47 +0000</bug_when>
    <thetext>Demo: http://jsbin.com/secuxo/edit?html,output</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125481</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-03-14 16:21:31 +0000</bug_when>
    <thetext>Sorry for getting back to you so late, I&apos;m still a bit at a loss as to what to do here. It seems browsers don&apos;t throw for this scenario... I guess they didn&apos;t update their implementation...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129106</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2018-03-22 18:02:27 +0000</bug_when>
    <thetext>I think I&apos;m fine with this behaving the way it is. Range mutations are already a little weird as they perform many DOM mutations each of which can have side effects.

If you still think this should be fixed, please file a new issue over at https://github.com/whatwg/dom/issues/new.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>