var divToStyle = root.getElementById("divtostyle");
// Make sure styleSheet counts are correct after appending a style to the ShadowRoot.
is(document.styleSheets.length, 1, "There should only be one style sheet on the document from the test style sheet.");
is(root.styleSheets.length, 0, "The ShadowRoot should have no style sheets.");
root.appendChild(shadowStyle);
is(document.styleSheets.length, 1, "Styles in the ShadowRoot element should not be accessible from the document.");
is(root.styleSheets.length, 1, "ShadowRoot should have one style sheet from the appened style.");
is(root.styleSheets[0].ownerNode, shadowStyle, "First style in ShadowRoot should match the style that was just appended.");
var dummyStyle = document.createElement("style");
root.appendChild(dummyStyle);
is(root.styleSheets.length, 2, "ShadowRoot should have an additional style from appending dummyStyle.");
is(root.styleSheets[1].ownerNode, dummyStyle, "Second style in ShadowRoot should be the dummyStyle.");
root.removeChild(dummyStyle);
is(root.styleSheets.length, 1, "Removing dummyStyle should remove it from the ShadowRoot style sheets.");
is(root.styleSheets[0].ownerNode, shadowStyle, "The style sheet remaining in the ShadowRoot should be shadowStyle.");
// Make sure that elements outside of the ShadowRoot are not affected by the ShadowRoot style.
isnot(getComputedStyle(document.getElementById("bodydiv"), null).getPropertyValue("height"), "100px", "Style sheets in ShadowRoot should not apply to elements no in the ShadowRoot.");
// Make sure that elements in the ShadowRoot are styled according to the ShadowRoot style.
is(getComputedStyle(divToStyle, null).getPropertyValue("height"), "100px", "ShadowRoot style sheets should apply to elements in ShadowRoot.");
is(getComputedStyle(divToStyle, null).getPropertyValue("height"), "200px", "Dynamic changes to styles in ShadowRoot should change style of affected elements.");