<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>100332</bug_id>
          
          <creation_ts>2012-10-24 23:04:24 -0700</creation_ts>
          <short_desc>[ShadowDOM]: Styles in shadow element presents in document.styleSheets collection</short_desc>
          <delta_ts>2019-10-04 22:21:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 7</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>63606</blocked>
    
    <blocked>103230</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Sergey G. Grekhov">sgrekhov</reporter>
          <assigned_to name="Web Components Team">webcomponents-bugzilla</assigned_to>
          <cc>a.semenov</cc>
    
    <cc>dglazkov</cc>
    
    <cc>morrita</cc>
    
    <cc>rniwa</cc>
    
    <cc>shinyak</cc>
    
    <cc>webcomponents-bugzilla</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>750392</commentid>
    <comment_count>0</comment_count>
    <who name="Sergey G. Grekhov">sgrekhov</who>
    <bug_when>2012-10-24 23:04:24 -0700</bug_when>
    <thetext>Found in Chrome 22.0.1229.94 m

According Shadow DOM spacification styles added to the shadow element shouldn&apos;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(&apos;iframe&apos;);
	iframe.src = &apos;resources/blank.html&apos;;
	document.body.appendChild(iframe);
	iframe.onload = function () {
		try {
			var d = iframe.contentDocument;
			var s = new SR(d.head);
			var style = d.createElement(&apos;style&apos;);
			s.appendChild(style);
			assert_equals(d.styleSheets.length, 0,
			         &apos;style elements in shadow DOM must not be exposed via &apos; +
			         &apos;the document.styleSheets collection&apos;);			
		} finally {
			iframe.parentNode.removeChild(iframe);
		}
	};

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

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;&lt;/body&gt;
&lt;/html&gt;


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(&apos;link&apos;);
			link.setAttribute(&apos;rel&apos;, &apos;stylesheet&apos;);
			link.setAttribute(&apos;href&apos;, &apos;testharness.css&apos;);
			s.appendChild(link);

The link from the above is not visible via document.styleSheets collection</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>855688</commentid>
    <comment_count>1</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2013-03-14 21:59:11 -0700</bug_when>
    <thetext>*** Bug 105274 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1577155</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-10-04 22:21:28 -0700</bug_when>
    <thetext>This has been fixed for v1 API.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>