[Webkit-unassigned] [Bug 100332] New: Styles in shadow element present in document.styleSheets collection

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 24 23:03:17 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=100332

           Summary: Styles in shadow element present in
                    document.styleSheets collection
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: sgrekhov at unipro.ru


Found in Chrome 22.0.1229.94 m

According Shadow DOM spacification styles added to the shadow element shouldn't be exposed via document.styleSheet collection (http://www.w3.org/TR/shadow-dom/#upper-boundary-encapsulation) but in fact these styles are visible. The following test fails:

var SR = window.ShadowRoot ||
         window.WebKitShadowRoot;

    var iframe = document.createElement('iframe');
    iframe.src = 'resources/blank.html';
    document.body.appendChild(iframe);
    iframe.onload = function () {
        try {
            var d = iframe.contentDocument;
            var s = new SR(d.head);
            var style = d.createElement('style');
            s.appendChild(style);
            assert_equals(d.styleSheets.length, 0,
                     'style elements in shadow DOM must not be exposed via ' +
                     'the document.styleSheets collection');            
        } finally {
            iframe.parentNode.removeChild(iframe);
        }
    };

blank.html in the test above is the simple page with the following HTML:

<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>


Please note that the similar tests for links (instead of style link to the css file is being created) works well. Exact code is:

            var link = d.createElement('link');
            link.setAttribute('rel', 'stylesheet');
            link.setAttribute('href', 'testharness.css');
            s.appendChild(link);

The link from the above is not visible via document.styleSheets collection

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list