11/* @flow */
22import hyphenateProperty from './hyphenateProperty'
33
4- const unitlessProperties = {
4+ const unitlessProperties : Object = {
55 borderImageOutset : true ,
66 borderImageSlice : true ,
77 borderImageWidth : true ,
@@ -13,7 +13,6 @@ const unitlessProperties = {
1313 widows : true ,
1414 zIndex : true ,
1515 zoom : true ,
16-
1716 // SVG-related properties
1817 fillOpacity : true ,
1918 floodOpacity : true ,
@@ -25,8 +24,8 @@ const unitlessProperties = {
2524 strokeWidth : true
2625}
2726
28- const prefixedUnitlessProperties = [
29- 'animationIterationCount' ,
27+ const prefixedUnitlessProperties : Array < string > = [
28+ 'animationIterationCount',
3029 'boxFlex',
3130 'boxFlexGroup',
3231 'boxOrdinalGroup',
@@ -43,25 +42,25 @@ const prefixedUnitlessProperties = [
4342 'lineClamp'
4443]
4544
46- const prefixes = [ 'Webkit' , 'ms' , 'Moz' , 'O' ]
45+ const prefixes: Array < string > = ['Webkit', 'ms', 'Moz', 'O']
4746
48- function getPrefixedProperty ( prefix , property ) {
47+ function getPrefixedProperty(prefix: string , property: string): string {
4948 return prefix + property . charAt ( 0 ) . toUpperCase ( ) + property . slice ( 1 )
5049}
5150
5251// add all prefixed properties to the unitless properties
5352for (let i = 0, len = prefixedUnitlessProperties.length; i < len ; ++ i ) {
53+ const property = prefixedUnitlessProperties [ i ]
5454 unitlessProperties [ property ] = true
5555
56- for ( let j = 0 , jLen = prefixes . length ; j < jLen ; ++ i ) {
57- unitlessProperties [ getPrefixedProperty ( prefix , property ) ] = true
56+ for ( let j = 0 , jLen = prefixes . length ; j < jLen ; ++ j ) {
57+ unitlessProperties [ getPrefixedProperty ( prefixes [ j ] , property ) ] = true
5858 }
5959}
6060
61-
6261// add all hypenated properties as well
6362for ( const property in unitlessProperties ) {
64- unitlessProperties [ hyphenateStyleName ( property ) ] = true
63+ unitlessProperties [ hyphenateProperty ( property ) ] = true
6564}
6665
6766export default function isUnitlessProperty ( property : string ) : boolean {
0 commit comments