New issue
Advanced search Search tips

Issue 732220 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Range.insertNode() should accept ShadowRoot argument

Project Member Reported by tkent@chromium.org, Jun 12 2017

Issue description

Chrome Version: 61 Canary
OS: All but iOS

What steps will reproduce the problem?
(1) Open the following document:

<body>
<script>
var r = new Range();
r.setStart(document.body,0);
var sr = document.body.attachShadow({mode:"open"});
r.insertNode(sr);
</script>

(2) Open DevTools console

What is the expected result?
No DOMException in the console.

What happens instead?
There is a DOMException:
> Uncaught DOMException: Failed to execute 'insertNode' on 'Range': The node to be inserted is a '#document-fragment' node, which may not be inserted here.

Please use labels and text to provide additional information.
The DOM specification [1] doesn't ask any special handling for ShadowRoot in Range.inertNode.  So we should treat a ShadowRoot same as DocumentFragment.

[1] https://dom.spec.whatwg.org/#concept-range-insert


Safari: OK
Firefox: No Shadow DOM
Edge: No Shadow DOM


 

Comment 1 by tkent@chromium.org, Jun 12 2017

Owner: tkent@chromium.org
Status: Started (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, Jun 12 2017

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

commit fc9b71a6ce42cb2fbe0bc6e154a1051bc3e92011
Author: Kent Tamura <tkent@chromium.org>
Date: Mon Jun 12 08:27:57 2017

Range.insertNode() should accept ShadowRoot argument.

The DOM specification [1] doesn't ask any special handling for ShadowRoot in
Range.insertNode.  So we should treat a ShadowRoot same as DocumentFragment.

[1] https://dom.spec.whatwg.org/#concept-range-insert

Bug:  732220 
Change-Id: Id907833514abcd447d5458a973a7a077cc3297c4
Reviewed-on: https://chromium-review.googlesource.com/530607
Reviewed-by: Hayato Ito <hayato@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478565}
[add] https://crrev.com/fc9b71a6ce42cb2fbe0bc6e154a1051bc3e92011/third_party/WebKit/LayoutTests/external/wpt/shadow-dom/Range-prototype-insertNode.html
[modify] https://crrev.com/fc9b71a6ce42cb2fbe0bc6e154a1051bc3e92011/third_party/WebKit/Source/core/dom/Range.cpp

Comment 3 by tkent@chromium.org, Jun 13 2017

Labels: M-61
Status: Fixed (was: Started)

Sign in to add a comment