1 | import hyphenateProperty from './hyphenateProperty';
|
---|
2 | var unitlessProperties = {
|
---|
3 | borderImageOutset: true,
|
---|
4 | borderImageSlice: true,
|
---|
5 | borderImageWidth: true,
|
---|
6 | fontWeight: true,
|
---|
7 | lineHeight: true,
|
---|
8 | opacity: true,
|
---|
9 | orphans: true,
|
---|
10 | tabSize: true,
|
---|
11 | widows: true,
|
---|
12 | zIndex: true,
|
---|
13 | zoom: true,
|
---|
14 | // SVG-related properties
|
---|
15 | fillOpacity: true,
|
---|
16 | floodOpacity: true,
|
---|
17 | stopOpacity: true,
|
---|
18 | strokeDasharray: true,
|
---|
19 | strokeDashoffset: true,
|
---|
20 | strokeMiterlimit: true,
|
---|
21 | strokeOpacity: true,
|
---|
22 | strokeWidth: true
|
---|
23 | };
|
---|
24 | var prefixedUnitlessProperties = ['animationIterationCount', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'gridColumn', 'gridColumnEnd', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowStart', 'lineClamp', 'order'];
|
---|
25 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
---|
26 |
|
---|
27 | function getPrefixedProperty(prefix, property) {
|
---|
28 | return prefix + property.charAt(0).toUpperCase() + property.slice(1);
|
---|
29 | } // add all prefixed properties to the unitless properties
|
---|
30 |
|
---|
31 |
|
---|
32 | for (var i = 0, len = prefixedUnitlessProperties.length; i < len; ++i) {
|
---|
33 | var property = prefixedUnitlessProperties[i];
|
---|
34 | unitlessProperties[property] = true;
|
---|
35 |
|
---|
36 | for (var j = 0, jLen = prefixes.length; j < jLen; ++j) {
|
---|
37 | unitlessProperties[getPrefixedProperty(prefixes[j], property)] = true;
|
---|
38 | }
|
---|
39 | } // add all hypenated properties as well
|
---|
40 |
|
---|
41 |
|
---|
42 | for (var _property in unitlessProperties) {
|
---|
43 | unitlessProperties[hyphenateProperty(_property)] = true;
|
---|
44 | }
|
---|
45 |
|
---|
46 | export default function isUnitlessProperty(property) {
|
---|
47 | return unitlessProperties.hasOwnProperty(property);
|
---|
48 | } |
---|