Skip to content

Commit d1ce9e6

Browse files
committed
CSS: Drop the cache in finalPropName
The `finalPropName` util caches properties detected to require a vendor prefix. This used to cache unprefixed properties as well, but it was reported that this logic broke accidentally during a refactor. Since fewer & fewer properties require a vendor prefix and caching a few basic checks likely has negligible perf benefits, opt to saving a few bytes and remove the cache. Ref gh-5582
1 parent d5ebb46 commit d1ce9e6

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/css/finalPropName.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { document } from "../var/document.js";
22

33
var cssPrefixes = [ "Webkit", "Moz", "ms" ],
4-
emptyStyle = document.createElement( "div" ).style,
5-
vendorProps = {};
4+
emptyStyle = document.createElement( "div" ).style;
65

7-
// Return a vendor-prefixed property or undefined
8-
function vendorPropName( name ) {
6+
// Return a potentially-mapped vendor prefixed property
7+
export function finalPropName( name ) {
8+
if ( name in emptyStyle ) {
9+
return name;
10+
}
911

1012
// Check for vendor prefixed names
1113
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
@@ -17,17 +19,6 @@ function vendorPropName( name ) {
1719
return name;
1820
}
1921
}
20-
}
2122

22-
// Return a potentially-mapped vendor prefixed property
23-
export function finalPropName( name ) {
24-
var final = vendorProps[ name ];
25-
26-
if ( final ) {
27-
return final;
28-
}
29-
if ( name in emptyStyle ) {
30-
return name;
31-
}
32-
return vendorProps[ name ] = vendorPropName( name ) || name;
23+
return name;
3324
}

0 commit comments

Comments
 (0)