MCPcopy Index your code
hub / github.com/mailru/FileAPI / createCSS

Function createCSS

flash/image/html-template/swfobject.js:542–573  ·  view source on GitHub ↗
(sel, decl, media, newStyle)

Source from the content-addressed store, hash-verified

540 - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
541 */
542 function createCSS(sel, decl, media, newStyle) {
543 if (ua.ie && ua.mac) { return; }
544 var h = doc.getElementsByTagName("head")[0];
545 if (!h) { return; } // to also support badly authored HTML pages that lack a head element
546 var m = (media && typeof media == "string") ? media : "screen";
547 if (newStyle) {
548 dynamicStylesheet = null;
549 dynamicStylesheetMedia = null;
550 }
551 if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
552 // create dynamic stylesheet + get a global reference to it
553 var s = createElement("style");
554 s.setAttribute("type", "text/css");
555 s.setAttribute("media", m);
556 dynamicStylesheet = h.appendChild(s);
557 if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
558 dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
559 }
560 dynamicStylesheetMedia = m;
561 }
562 // add style rule
563 if (ua.ie && ua.win) {
564 if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
565 dynamicStylesheet.addRule(sel, decl);
566 }
567 }
568 else {
569 if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
570 dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
571 }
572 }
573 }
574
575 function setVisibility(id, isVisible) {
576 if (!autoHideShow) { return; }

Callers 2

setVisibilityFunction · 0.70
swfobject.jsFile · 0.70

Calls 1

createElementFunction · 0.70

Tested by

no test coverage detected