1(function ($) { 2 // Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform' 3 // property uniformly across Safari/Chrome/Webkit, Firefox 3.5+, IE 9+, and Opera 11+. 4 // 2009-2011 Zachary Johnson www.zachstronaut.com 5 // Updated 2011.05.04 (May the fourth be with you!) 6 function getTransformProperty(element) 7 { 8 // Try transform first for forward compatibility 9 // In some versions of IE9, it is critical for msTransform to be in 10 // this list before MozTranform. 11 var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform']; 12 var p; 13 while (p = properties.shift()) 14 { 15 if (typeof element.style[p] != 'undefined') 16 { 17 return p; 18 } 19 } 20 21 // Default to transform also 22 return 'transform'; 23 } 24 25 var _propsObj = null; 26 27 var proxied = $.fn.css; 28 $.fn.css = function (arg, val) 29 { 30 // Temporary solution for current 1.6.x incompatibility, while 31 // preserving 1.3.x compatibility, until I can rewrite using CSS Hooks 32 if (_propsObj === null) 33 { 34 if (typeof $.cssProps != 'undefined') 35 { 36 _propsObj = $.cssProps; 37 } 38 else if (typeof $.props != 'undefined') 39 { 40 _propsObj = $.props; 41 } 42 else 43 { 44 _propsObj = {} 45 } 46 } 47 48 // Find the correct browser specific property and setup the mapping using 49 // $.props which is used internally by jQuery.attr() when setting CSS 50 // properties via either the css(name, value) or css(properties) method. 51 // The problem with doing this once outside of css() method is that you 52 // need a DOM node to find the right CSS property, and there is some risk 53 // that somebody would call the css() method before body has loaded or any 54 // DOM-is-ready events have fired. 55 if 56 ( 57 typeof _propsObj['transform'] == 'undefined' 58 && 59 ( 60 arg == 'transform' 61 || 62 ( 63 typeof arg == 'object' 64 && typeof arg['transform'] != 'undefined' 65 ) 66 ) 67 ) 68 { 69 _propsObj['transform'] = getTransformProperty(this.get(0)); 70 } 71 72 // We force the property mapping here because jQuery.attr() does 73 // property mapping with jQuery.props when setting a CSS property, 74 // but curCSS() does *not* do property mapping when *getting* a 75 // CSS property. (It probably should since it manually does it 76 // for 'float' now anyway... but that'd require more testing.) 77 // 78 // But, only do the forced mapping if the correct CSS property 79 // is not 'transform' and is something else. 80 if (_propsObj['transform'] != 'transform') 81 { 82 // Call in form of css('transform' ...) 83 if (arg == 'transform') 84 { 85 arg = _propsObj['transform']; 86 87 // User wants to GET the transform CSS, and in jQuery 1.4.3 88 // calls to css() for transforms return a matrix rather than 89 // the actual string specified by the user... avoid that 90 // behavior and return the string by calling jQuery.style() 91 // directly 92 if (typeof val == 'undefined' && jQuery.style) 93 { 94 return jQuery.style(this.get(0), arg); 95 } 96 } 97 98 // Call in form of css({'transform': ...}) 99 else if 100 ( 101 typeof arg == 'object' 102 && typeof arg['transform'] != 'undefined' 103 ) 104 { 105 arg[_propsObj['transform']] = arg['transform']; 106 delete arg['transform']; 107 } 108 } 109 110 return proxied.apply(this, arguments); 111 }; 112})(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.