source: imaps-frontend/node_modules/css-in-js-utils/es/isUnitlessProperty.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import hyphenateProperty from './hyphenateProperty';
2var 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};
24var prefixedUnitlessProperties = ['animationIterationCount', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'gridColumn', 'gridColumnEnd', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowStart', 'lineClamp', 'order'];
25var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
26
27function getPrefixedProperty(prefix, property) {
28 return prefix + property.charAt(0).toUpperCase() + property.slice(1);
29} // add all prefixed properties to the unitless properties
30
31
32for (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
42for (var _property in unitlessProperties) {
43 unitlessProperties[hyphenateProperty(_property)] = true;
44}
45
46export default function isUnitlessProperty(property) {
47 return unitlessProperties.hasOwnProperty(property);
48}
Note: See TracBrowser for help on using the repository browser.