source: imaps-frontend/node_modules/inline-style-prefixer/lib/createPrefixer.js@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.9 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = createPrefixer;
7
8var _prefixProperty = require('./utils/prefixProperty');
9
10var _prefixProperty2 = _interopRequireDefault(_prefixProperty);
11
12var _prefixValue = require('./utils/prefixValue');
13
14var _prefixValue2 = _interopRequireDefault(_prefixValue);
15
16var _addNewValuesOnly = require('./utils/addNewValuesOnly');
17
18var _addNewValuesOnly2 = _interopRequireDefault(_addNewValuesOnly);
19
20var _isObject = require('./utils/isObject');
21
22var _isObject2 = _interopRequireDefault(_isObject);
23
24function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
26function createPrefixer(_ref) {
27 var prefixMap = _ref.prefixMap,
28 plugins = _ref.plugins;
29
30 return function prefix(style) {
31 for (var property in style) {
32 var value = style[property];
33
34 // handle nested objects
35 if ((0, _isObject2.default)(value)) {
36 style[property] = prefix(value);
37 // handle array values
38 } else if (Array.isArray(value)) {
39 var combinedValue = [];
40
41 for (var i = 0, len = value.length; i < len; ++i) {
42 var processedValue = (0, _prefixValue2.default)(plugins, property, value[i], style, prefixMap);
43
44 (0, _addNewValuesOnly2.default)(combinedValue, processedValue || value[i]);
45 }
46
47 // only modify the value if it was touched
48 // by any plugin to prevent unnecessary mutations
49 if (combinedValue.length > 0) {
50 style[property] = combinedValue;
51 }
52 } else {
53 var _processedValue = (0, _prefixValue2.default)(plugins, property, value, style, prefixMap);
54
55 // only modify the value if it was touched
56 // by any plugin to prevent unnecessary mutations
57 if (_processedValue) {
58 style[property] = _processedValue;
59 }
60
61 style = (0, _prefixProperty2.default)(prefixMap, property, style);
62 }
63 }
64
65 return style;
66 };
67}
Note: See TracBrowser for help on using the repository browser.