1// http://rule52.com/2008/06/css-rule-page-load/ 2// vim: et ts=2 sts=2 sw=2 3 4// Example usage: CSSRules.add('#revealContent', 'display: none !important'); 5 6var CSSRules = function() { 7 8 var headElement = document.getElementsByTagName("head")[0]; 9 var styleElement = document.createElement("style"); 10 styleElement.type = "text/css"; 11 headElement.appendChild(styleElement); 12 13 // browser-dependent add function 14 var add = function() { 15 // IE doesn't allow you to append text nodes to <style> elements 16 if (styleElement.styleSheet) { 17 return function(selector, rule) { 18 if (styleElement.styleSheet.cssText == '') { 19 styleElement.styleSheet.cssText = ''; 20 } 21 styleElement.styleSheet.cssText += selector + " { " + rule + " }"; 22 } 23 } else { 24 return function(selector, rule) { 25 styleElement.appendChild(document.createTextNode(selector + " { " + rule + " }")); 26 } 27 } 28 }(); 29 30 return { 31 add : add 32 } 33}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.