Issue #2135 - Bug 1410578: Make <link rel="stylesheet"> work in shadow trees

This commit is contained in:
FranklinDM 2023-03-04 00:53:46 +08:00 committed by roytam1
commit 588c2154a5
4 changed files with 21 additions and 49 deletions

View file

@ -22,22 +22,7 @@ isnot(document.baseURI, "http://www.example.org/", "Base element should be inert
SimpleTest.waitForExplicitFinish();
// Check that <link> is inert.
var numStyleBeforeLoad = document.styleSheets.length;
shadow.innerHTML = '<link id="shadowlink" rel="stylesheet" type="text/css" href="inert_style.css" /><span id="shadowspan"></span>';
shadow.applyAuthorStyles = true;
var shadowSpan = shadow.getElementById("shadowspan");
var shadowStyle = shadow.getElementById("shadowlink");
function runChecks() {
isnot(getComputedStyle(shadowSpan, null).getPropertyValue("padding-top"), "10px", "Link element should be inert.");
is(document.styleSheets.length, numStyleBeforeLoad, "Document style count should remain the same because the style should not be in the doucment.");
is(shadow.styleSheets.length, 0, "Inert link should not add style to ShadowRoot.");
// Remove link to make sure we don't get assertions.
shadow.removeChild(shadowStyle);
SimpleTest.finish();
};
SimpleTest.finish();
</script>
</body>