New issue
Advanced search Search tips

Issue 649697 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

shadow DOM getElementById doesn't return DOM object.

Reported by ka...@geospock.com, Sep 23 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Steps to reproduce the problem:
1. Create document containing empty div with id=HERE
2. Add script;

setTimeout(function() {
    console.log("Reproduction attempt....");
    var mydiv = document.getElementById("HERE");

    console.log(mydiv);
    console.log(typeof(mydiv));

    var otherdiv = document.createElement("div");
    var myshad = mydiv.attachShadow({mode: "open"});
    myshad.innerHTML = '<div id="SHADDIV">Hello</div>';
    var t = myshad.getElementById("SHADDIV");

    console.log(t);
    console.log(typeof(t));
    console.log(Object.keys(t));

    t.appendChild(otherdiv); // errors.
}, 500);

3. Open Console. Load page. 

What is the expected behavior?
No error.

What went wrong?
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Did this work before? N/A 

Chrome version: 53.0.2785.116  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 23.0 r0

shadow dom getElementById operations are returning an object with no methods. (Can see this in console log).

This upsets appendChild which wants a Node...
 
I have done some more testing on this -- the problem doesn't seem to be with Chrome on its own -- when the webcomponents ShadowDOM.js is loaded, it doesn't seem to be detecting that a shadow dom implementation exists and instead breaks it...

Amd I wrong in expecting the shim to disable itself if it's not needed?

Comment 2 by kojii@chromium.org, Sep 26 2016

Cc: kojii@chromium.org
Components: -Blink Blink>WebComponents
Labels: -Via-Wizard -OS-Mac Needs-Feedback OS-All
I can't reproduce the error, using this jsbin:
http://jsbin.com/qequqo/edit?html,output
on 53.0.2785.116.

Could you create a reproducing file and attach to this bug if you can still reproduce?

Comment 4 by kojii@chromium.org, Sep 26 2016

Your code says it loads polyfill, so it doesn't look like it's using the native shadow DOM for some reasons. Can you debug?
Project Member

Comment 5 by sheriffbot@chromium.org, Oct 4 2016

Labels: -Needs-Feedback Needs-Review
Owner: kojii@chromium.org
Thank you for providing more feedback. Adding requester "kojii@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by kojii@chromium.org, Oct 4 2016

Labels: -Needs-Review
Status: WontFix (was: Unconfirmed)
Closing as I'm not getting responses. Please add comments if you could reproduce without using polyfill, and I'll reopen.

Sign in to add a comment