90 lines
2.5 KiB
HTML
90 lines
2.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<link id="sheet" rel="stylesheet" href="data:tex/css,#test-element{text-decoration:line-through}">
|
|
<link id="notsheet" rel="author" href="mailto:nosuch@webkit.org">
|
|
<link id="alt" rel="alternate stylesheet" title="altset" href="resources/green.css">
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<span id="test-element"></span>
|
|
|
|
<script>
|
|
|
|
description("Series of tests to validate behavior of getting/setting link.disabled and link.sheet.disabled.<br>" +
|
|
'Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=61400">61400</a>: REGRESSION(84329): Stylesheets on some pages do not load');
|
|
|
|
window.jsTestIsAsync = true;
|
|
|
|
function onSheetLoaded(f, elem, maxtime) {
|
|
if (elem.sheet || maxtime <= 0)
|
|
f(elem);
|
|
else
|
|
setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
|
|
}
|
|
|
|
|
|
|
|
// With a non-stylesheet <link>, 'disabled' is always false.
|
|
|
|
var testElement = document.getElementById("test-element");
|
|
var originalBG = getComputedStyle(testElement).backgroundColor;
|
|
var link;
|
|
|
|
debug("notsheet");
|
|
|
|
link = document.getElementById("notsheet");
|
|
shouldBeNull("link.sheet");
|
|
link.disabled = true;
|
|
shouldBeFalse("link.disabled");
|
|
|
|
|
|
// With a stylesheet <link>, 'disabled' and 'link.style.disabled' should both
|
|
// work, and be consistent with each other.
|
|
|
|
debug("sheet");
|
|
|
|
link = document.getElementById("sheet");
|
|
shouldBeNonNull("link.sheet");
|
|
|
|
link.sheet.disabled = true;
|
|
shouldBeTrue("link.disabled");
|
|
shouldBeTrue("link.sheet.disabled");
|
|
shouldBeEqualToString("getComputedStyle(testElement).textDecoration", "none");
|
|
|
|
link.disabled = false;
|
|
shouldBeFalse("link.disabled");
|
|
shouldBeFalse("link.sheet.disabled");
|
|
shouldBeEqualToString("getComputedStyle(testElement).textDecoration", "line-through");
|
|
|
|
link.sheet.disabled = false;
|
|
|
|
|
|
// An alternate stylesheet defaults to disabled when its title does not
|
|
// match the preferred set.
|
|
|
|
debug("altsheet");
|
|
link = document.getElementById("alt");
|
|
shouldBeTrue("link.disabled");
|
|
|
|
// Toggling link.disabled activates the stylesheet.
|
|
|
|
function altSheetLoaded(e) {
|
|
link = e;
|
|
shouldBeNonNull("link.sheet");
|
|
shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'");
|
|
|
|
link.disabled = true;
|
|
shouldBe("getComputedStyle(testElement).backgroundColor", "originalBG");
|
|
|
|
finishJSTest();
|
|
}
|
|
|
|
link.disabled = false;
|
|
onSheetLoaded(altSheetLoaded, link, 500);
|
|
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body></html>
|