Allow loading multiple stylesheets for the same link element.

This commit is contained in:
Josh Matthews 2017-04-13 16:02:17 +10:00
parent ca3cd64d6b
commit 3c3311b16a
7 changed files with 76 additions and 6 deletions

View file

@ -0,0 +1,4 @@
p {
background-color: red;
color: black;
}

View file

@ -0,0 +1,8 @@
<!doctype html>
<meta charset="utf-8">
<style>
p {
color: green;
}
</style>
<p>This text should be green on a white background

View file

@ -0,0 +1,13 @@
<!doctype html>
<meta charset="utf-8">
<title>Obtaining a new stylesheet removes styles from the previous stylesheet.</title>
<link rel=match href=stylesheet-change-href-ref.html>
<script>
function changeHref() {
var elem = document.getElementById('stylesheet');
elem.href = 'resources/good.css';
elem.onload = null;
}
</script>
<link id=stylesheet rel=stylesheet href="resources/bad.css" onload="changeHref()">
<p>This text should be green on a white background