blob: 352d18a2756cf3f2566603820cbba00a8a4c42cb [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001define( [
2 "../var/document",
3 "../core"
4], function( document, jQuery ) {
5
6"use strict";
7
8var cssPrefixes = [ "Webkit", "Moz", "ms" ],
9 emptyStyle = document.createElement( "div" ).style,
10 vendorProps = {};
11
12// Return a vendor-prefixed property or undefined
13function 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
28function 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
40return finalPropName;
41
42} );