1(function($) { 2 if ($.fn.style) { 3 return; 4 } 5 6 // Escape regex chars with \ 7 var escape = function(text) { 8 return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 9 }; 10 11 // For those who need them (< IE 9), add support for CSS functions 12 var isStyleFuncSupported = !!CSSStyleDeclaration.prototype.getPropertyValue; 13 if (!isStyleFuncSupported) { 14 CSSStyleDeclaration.prototype.getPropertyValue = function(a) { 15 return this.getAttribute(a); 16 }; 17 CSSStyleDeclaration.prototype.setProperty = function(styleName, value, priority) { 18 this.setAttribute(styleName, value); 19 var priority = typeof priority != 'undefined' ? priority : ''; 20 if (priority != '') { 21 // Add priority manually 22 var rule = new RegExp(escape(styleName) + '\\s*:\\s*' + escape(value) + 23 '(\\s*;)?', 'gmi'); 24 this.cssText = 25 this.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';'); 26 } 27 }; 28 CSSStyleDeclaration.prototype.removeProperty = function(a) { 29 return this.removeAttribute(a); 30 }; 31 CSSStyleDeclaration.prototype.getPropertyPriority = function(styleName) { 32 var rule = new RegExp(escape(styleName) + '\\s*:\\s*[^\\s]*\\s*!important(\\s*;)?', 33 'gmi'); 34 return rule.test(this.cssText) ? 'important' : ''; 35 } 36 } 37 38 // The style function 39 $.fn.style = function(styleName, value, priority) { 40 // DOM node 41 var node = this.get(0); 42 // Ensure we have a DOM node 43 if (typeof node == 'undefined') { 44 return this; 45 } 46 // CSSStyleDeclaration 47 var style = this.get(0).style; 48 // Getter/Setter 49 if (typeof styleName != 'undefined') { 50 if (typeof value != 'undefined') { 51 // Set style property 52 priority = typeof priority != 'undefined' ? priority : ''; 53 style.setProperty(styleName, value, priority); 54 return this; 55 } else { 56 // Get style property 57 return style.getPropertyValue(styleName); 58 } 59 } else { 60 // Get CSSStyleDeclaration 61 return style; 62 } 63 }; 64})(jQuery);
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.