JSFiddle - React, Tailwind, and code Playground
by dledle2
HTML
<link rel="stylesheet" type="text/css" href="default.css" title="Default">
<link rel="alternate stylesheet" type="text/css" href="Foo.css" title="Foo">Default stylesheet:
<input type="radio" ... onclick="changeActiveStyleSheet('Foo', 'Default');">Foo stylesheet:
<input type="radio" ... onclick="changeActiveStyleSheet('Default', 'Foo');">
JavaScript
javascript:
try {
alert(document.styleSheets);
alert(document.styleSheets.length);
alert(outerHTML(document.styleSheets[0]));
function outerHTML(node) {
return node.outerHTML || new XMLSerializer().serializeToString(node);
}
alert(document.styleSheets.length);
alert(document.styleSheets[2].media);
alert(document.styleSheets[2].media.length);
document.styleSheets[0].media = 'print';
alert('item: ' + document.styleSheets[0].media.item());
alert(document.styleSheets[0].media.mediaText);
try {
document.styleSheets[0].media.deleteMedium(document.styleSheets[0].media.mediaText);
} catch (e2) {}
try {
document.styleSheets[1].media.deleteMedium(document.styleSheets[1].media.mediaText);
} catch (e3) {}
try {
document.styleSheets[2].media.deleteMedium(document.styleSheets[2].media.mediaText);
} catch (e3) {}
document.styleSheets[0].media.appendMedium('projection');
/* displayStyleSheetProperties(2); */
var myLinkElement = document.styleSheets[0].ownerNode;
alert( myLinkElement);
/* frameid.parentNode.removeChild(frameid); */
myLinkElement.parentNode.removeChild(myLinkElement);
alert( document.styleSheets[0].ownerNode.cssText);
alert('hi: ' + document.styleSheets[0].media.mediaText);
function changeActiveStyleSheet(strNewMediaScreenURL) {
if (document.styleSheets) {
alert(document.styleSheets.length);
document.styleSheets[0].disabled = true;
}
}
function displayStyleSheetProperties(intIndexNum) {
var str = "";
if (!document.styleSheets) {
str = "Your browser does not support the stylesheets object.";
} else if (!document.styleSheets.length) {
str = "There were no stylesheets found in the document.styleSheets collection.";
} else {
var prop, stylesheet =...