New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 616760 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Range::createContextualFragment should not thow when the context node is not HTML-or-SVG

Reported by bzbar...@mit.edu, Jun 2 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:49.0) Gecko/20100101 Firefox/49.0

Example URL:

Steps to reproduce the problem:
1. Run the following script:

  var div = document.createElementNS("foo", "div");
  var r = document.createRange();
  r.selectNodeContents(div);
  var frag = r.createContextualFragment("<body><p></p></body>");
  div.appendChild(frag);
  document.documentElement.appendChild(document.createTextNode(new XMLSerializer().serializeToString(div)));

What is the expected behavior?
The createContextualFragment call succeeds.

What went wrong?
The createContextualFragment call throws:

  Uncaught NotSupportedError: Failed to execute 'createContextualFragment' on 'Range': The range's container must be an HTML or SVG Element, Document, or DocumentFragment.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? N/A 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 52.0.2743.19 (Official Build) dev (64-bit)  Channel: n/a
OS Version: OS X 10.10
Flash Version: Shockwave Flash 21.0 r0

This works correctly in Firefox and Edge.
 
Cc: kavvaru@chromium.org
Components: Platform>DevTools
Labels: -Type-Compat M-53 OS-Linux OS-Windows Type-Bug
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on windows 7, Linux Ubuntu 14.04 and Mac 10.11.5 using chrome version 51.0.2704.79 and canary 53.0.2754.1.

This is non regression issue as this is observed from M30 builds.Marking it as Untriaged to get it addressed.

Thanks,

Comment 2 by bzbar...@mit.edu, Jun 3 2016

"DevTools" doesn't seem like the right component here.  DOM should be.  This has nothing at all to do with devtools.
Components: -Platform>DevTools Blink>Bindings Blink>DOM
DevTools isn't related to this issue, forward it to bindings and dom.
Owner: dominicc@chromium.org
Feel free to poach.

Comment 5 by tkent@chromium.org, Jun 24 2016

Components: -Blink>Bindings
Labels: -M-53 Hotlist-Interop
Owner: ----
Status: Available (was: Untriaged)
Summary: Range::createContextualFragment should not thow when the context node is not HTML-or-SVG (was: createContextualFragment thows when the context node is not HTML-or-SVG)
Owner: rob.b...@samsung.com
Status: Assigned (was: Available)
Taking a look.
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 23 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a695888f5a4372b346a2d9c2650c8d81e9a5434b

commit a695888f5a4372b346a2d9c2650c8d81e9a5434b
Author: rob.buis <rob.buis@samsung.com>
Date: Fri Sep 23 04:02:46 2016

Update createContextualFragment behavior to latest spec

Update createContextualFragment behavior to latest spec listed under [1].
This means specifically we do not throw an exception when the context node is
not HTML or SVG and if initially the context element is null, we follow step 2
to create an appropriate context element to be used in step 3.

Behavior matches Firefox and Safari.

BUG= 616760 

[1] https://w3c.github.io/DOM-Parsing/#extensions-to-the-range-interface

Review-Url: https://codereview.chromium.org/2356373002
Cr-Commit-Position: refs/heads/master@{#420573}

[modify] https://crrev.com/a695888f5a4372b346a2d9c2650c8d81e9a5434b/third_party/WebKit/LayoutTests/fast/dom/Range/create-contextual-fragment-from-bodyless-xml-document-range.html
[modify] https://crrev.com/a695888f5a4372b346a2d9c2650c8d81e9a5434b/third_party/WebKit/LayoutTests/fast/dom/Range/create-contextual-fragment-from-xml-element-range.html
[modify] https://crrev.com/a695888f5a4372b346a2d9c2650c8d81e9a5434b/third_party/WebKit/Source/core/dom/Range.cpp

Status: Fixed (was: Assigned)
Fixed by r420573.

Sign in to add a comment