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.
,
Jun 3 2016
"DevTools" doesn't seem like the right component here. DOM should be. This has nothing at all to do with devtools.
,
Jun 4 2016
DevTools isn't related to this issue, forward it to bindings and dom.
,
Jun 6 2016
Feel free to poach.
,
Jun 24 2016
,
Sep 21 2016
Taking a look.
,
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
,
Sep 23 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by kavvaru@chromium.org
, Jun 3 2016Components: Platform>DevTools
Labels: -Type-Compat M-53 OS-Linux OS-Windows Type-Bug
Status: Untriaged (was: Unconfirmed)