1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = void 0;
|
---|
7 |
|
---|
8 | var _plugin = _interopRequireDefault(require("../plugin"));
|
---|
9 |
|
---|
10 | var _browsers = require("../dictionary/browsers");
|
---|
11 |
|
---|
12 | var _identifiers = require("../dictionary/identifiers");
|
---|
13 |
|
---|
14 | var _postcss = require("../dictionary/postcss");
|
---|
15 |
|
---|
16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
17 |
|
---|
18 | const hacks = '!_$_&_*_)_=_%_+_,_._/_`_]_#_~_?_:_|'.split('_');
|
---|
19 |
|
---|
20 | var _default = (0, _plugin.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.ATRULE, _postcss.DECL], function (node) {
|
---|
21 | if (node.type === _postcss.DECL) {
|
---|
22 | // some values are not picked up by before, so ensure they are
|
---|
23 | // at the beginning of the value
|
---|
24 | hacks.some(hack => {
|
---|
25 | if (!node.prop.indexOf(hack)) {
|
---|
26 | this.push(node, {
|
---|
27 | identifier: _identifiers.PROPERTY,
|
---|
28 | hack: node.prop
|
---|
29 | });
|
---|
30 | return true;
|
---|
31 | }
|
---|
32 | });
|
---|
33 | let {
|
---|
34 | before
|
---|
35 | } = node.raws;
|
---|
36 |
|
---|
37 | if (!before) {
|
---|
38 | return;
|
---|
39 | }
|
---|
40 |
|
---|
41 | hacks.some(hack => {
|
---|
42 | if (~before.indexOf(hack)) {
|
---|
43 | this.push(node, {
|
---|
44 | identifier: _identifiers.PROPERTY,
|
---|
45 | hack: `${before.trim()}${node.prop}`
|
---|
46 | });
|
---|
47 | return true;
|
---|
48 | }
|
---|
49 | });
|
---|
50 | } else {
|
---|
51 | // test for the @property: value; hack
|
---|
52 | let {
|
---|
53 | name
|
---|
54 | } = node;
|
---|
55 | let len = name.length - 1;
|
---|
56 |
|
---|
57 | if (name.lastIndexOf(':') === len) {
|
---|
58 | this.push(node, {
|
---|
59 | identifier: _identifiers.PROPERTY,
|
---|
60 | hack: `@${name.substr(0, len)}`
|
---|
61 | });
|
---|
62 | }
|
---|
63 | }
|
---|
64 | });
|
---|
65 |
|
---|
66 | exports.default = _default;
|
---|
67 | module.exports = exports.default; |
---|