Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | define( [ |
| 2 | "../var/document", |
| 3 | "../core" |
| 4 | ], function( document, jQuery ) { |
| 5 | |
| 6 | "use strict"; |
| 7 | |
| 8 | var cssPrefixes = [ "Webkit", "Moz", "ms" ], |
| 9 | emptyStyle = document.createElement( "div" ).style, |
| 10 | vendorProps = {}; |
| 11 | |
| 12 | // Return a vendor-prefixed property or undefined |
| 13 | function vendorPropName( name ) { |
| 14 | |
| 15 | // Check for vendor prefixed names |
| 16 | var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), |
| 17 | i = cssPrefixes.length; |
| 18 | |
| 19 | while ( i-- ) { |
| 20 | name = cssPrefixes[ i ] + capName; |
| 21 | if ( name in emptyStyle ) { |
| 22 | return name; |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | // Return a potentially-mapped jQuery.cssProps or vendor prefixed property |
| 28 | function finalPropName( name ) { |
| 29 | var final = jQuery.cssProps[ name ] || vendorProps[ name ]; |
| 30 | |
| 31 | if ( final ) { |
| 32 | return final; |
| 33 | } |
| 34 | if ( name in emptyStyle ) { |
| 35 | return name; |
| 36 | } |
| 37 | return vendorProps[ name ] = vendorPropName( name ) || name; |
| 38 | } |
| 39 | |
| 40 | return finalPropName; |
| 41 | |
| 42 | } ); |