Bug 89172 - [Shadow] parentTreeScope() of nested shadow DOM subtree returns document().
Summary: [Shadow] parentTreeScope() of nested shadow DOM subtree returns document().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 89694 (view as bug list)
Depends on:
Blocks: 89073
  Show dependency treegraph
 
Reported: 2012-06-14 22:51 PDT by Takashi Sakamoto
Modified: 2012-07-13 05:21 PDT (History)
5 users (show)

See Also:


Attachments
Patch (8.49 KB, patch)
2012-06-15 01:05 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (8.40 KB, patch)
2012-06-21 20:36 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Sakamoto 2012-06-14 22:51:26 PDT
<body>
<div id="test">
</div>
<script>
    var div = document.getElementById("test");
    var shadow1 = new WebKitShadowRoot(div);
    shadow1.innerHTML = "<div id='E'></div>";

    var e = shadow1.getElementById("E");
    var shadow2 = new WebKitShadowRoot(e);
    shadow2.innerHTML = "<div id='F'></div>";

    var f = shadow2.getElementById("F");
    var shadow3 = new WebKitShadowRoot(f);
    shadow3.innerHTML = "<div id='G'></div>";
</script>
</body>

The shadow1, shadow2, and shadow3's parentTreeScope() are the same as document(). If creating the same DOM tree by using the following script, parentTreeScope() returns correct parent tree scope.

<script>
    var f = document.createElement("div");
    var shadow3 = new WebKitShadowRoot(f);
    shadow3.innerHTML = "<div id='G'></div>";

    var e = document.createElement("div");
    var shadow2 = new WebKitShadowRoot(e);
    shadow2.appendChild(f);

    var test = document.getElementById("test");
    var shadow1 = new WebKitShadowRoot(test);
    shadow1.appendChild(e);
</script>
Comment 1 Takashi Sakamoto 2012-06-15 01:05:55 PDT
Created attachment 147770 [details]
Patch
Comment 2 Shinya Kawanaka 2012-06-20 14:09:47 PDT
Looks sane for me, wait for the reviewers' comment!
Comment 3 Hajime Morrita 2012-06-20 19:14:42 PDT
Comment on attachment 147770 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=147770&action=review

> Source/WebCore/testing/Internals.cpp:208
> +Node* Internals::parentTreeScopeRootNode(Node* node, ExceptionCode& ec)

Why not just pass a TreeScope and make this parentScope() or something?
I hope Internals APIs be a set of thin wrappers of private DOM API to make them orthogonal.
Comment 4 Shinya Kawanaka 2012-06-21 17:32:19 PDT
Comment on attachment 147770 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=147770&action=review

>> Source/WebCore/testing/Internals.cpp:208
>> +Node* Internals::parentTreeScopeRootNode(Node* node, ExceptionCode& ec)
> 
> Why not just pass a TreeScope and make this parentScope() or something?
> I hope Internals APIs be a set of thin wrappers of private DOM API to make them orthogonal.

Is TreeScope available from JS...?
Comment 5 Takashi Sakamoto 2012-06-21 20:36:06 PDT
Created attachment 148952 [details]
Patch
Comment 6 WebKit Review Bot 2012-06-22 09:01:03 PDT
Comment on attachment 148952 [details]
Patch

Clearing flags on attachment: 148952

Committed r121027: <http://trac.webkit.org/changeset/121027>
Comment 7 WebKit Review Bot 2012-06-22 09:01:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Sudarsana Nagineni (babu) 2012-07-13 05:21:59 PDT
*** Bug 89694 has been marked as a duplicate of this bug. ***