You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.6 KiB
48 lines
1.6 KiB
import hyphenateProperty from './hyphenateProperty';
|
|
var unitlessProperties = {
|
|
borderImageOutset: true,
|
|
borderImageSlice: true,
|
|
borderImageWidth: true,
|
|
fontWeight: true,
|
|
lineHeight: true,
|
|
opacity: true,
|
|
orphans: true,
|
|
tabSize: true,
|
|
widows: true,
|
|
zIndex: true,
|
|
zoom: true,
|
|
// SVG-related properties
|
|
fillOpacity: true,
|
|
floodOpacity: true,
|
|
stopOpacity: true,
|
|
strokeDasharray: true,
|
|
strokeDashoffset: true,
|
|
strokeMiterlimit: true,
|
|
strokeOpacity: true,
|
|
strokeWidth: true
|
|
};
|
|
var prefixedUnitlessProperties = ['animationIterationCount', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'gridColumn', 'gridColumnEnd', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowStart', 'lineClamp', 'order'];
|
|
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
|
|
|
function getPrefixedProperty(prefix, property) {
|
|
return prefix + property.charAt(0).toUpperCase() + property.slice(1);
|
|
} // add all prefixed properties to the unitless properties
|
|
|
|
|
|
for (var i = 0, len = prefixedUnitlessProperties.length; i < len; ++i) {
|
|
var property = prefixedUnitlessProperties[i];
|
|
unitlessProperties[property] = true;
|
|
|
|
for (var j = 0, jLen = prefixes.length; j < jLen; ++j) {
|
|
unitlessProperties[getPrefixedProperty(prefixes[j], property)] = true;
|
|
}
|
|
} // add all hypenated properties as well
|
|
|
|
|
|
for (var _property in unitlessProperties) {
|
|
unitlessProperties[hyphenateProperty(_property)] = true;
|
|
}
|
|
|
|
export default function isUnitlessProperty(property) {
|
|
return unitlessProperties.hasOwnProperty(property);
|
|
} |