source: trip-planner-front/node_modules/autoprefixer/lib/old-selector.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.9 KB
Line 
1"use strict";
2
3function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
4
5function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
7function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
9var OldSelector = /*#__PURE__*/function () {
10 function OldSelector(selector, prefix) {
11 this.prefix = prefix;
12 this.prefixed = selector.prefixed(this.prefix);
13 this.regexp = selector.regexp(this.prefix);
14 this.prefixeds = selector.possible().map(function (x) {
15 return [selector.prefixed(x), selector.regexp(x)];
16 });
17 this.unprefixed = selector.name;
18 this.nameRegexp = selector.regexp();
19 }
20 /**
21 * Is rule a hack without unprefixed version bottom
22 */
23
24
25 var _proto = OldSelector.prototype;
26
27 _proto.isHack = function isHack(rule) {
28 var index = rule.parent.index(rule) + 1;
29 var rules = rule.parent.nodes;
30
31 while (index < rules.length) {
32 var before = rules[index].selector;
33
34 if (!before) {
35 return true;
36 }
37
38 if (before.includes(this.unprefixed) && before.match(this.nameRegexp)) {
39 return false;
40 }
41
42 var some = false;
43
44 for (var _iterator = _createForOfIteratorHelperLoose(this.prefixeds), _step; !(_step = _iterator()).done;) {
45 var _step$value = _step.value,
46 string = _step$value[0],
47 regexp = _step$value[1];
48
49 if (before.includes(string) && before.match(regexp)) {
50 some = true;
51 break;
52 }
53 }
54
55 if (!some) {
56 return true;
57 }
58
59 index += 1;
60 }
61
62 return true;
63 }
64 /**
65 * Does rule contain an unnecessary prefixed selector
66 */
67 ;
68
69 _proto.check = function check(rule) {
70 if (!rule.selector.includes(this.prefixed)) {
71 return false;
72 }
73
74 if (!rule.selector.match(this.regexp)) {
75 return false;
76 }
77
78 if (this.isHack(rule)) {
79 return false;
80 }
81
82 return true;
83 };
84
85 return OldSelector;
86}();
87
88module.exports = OldSelector;
Note: See TracBrowser for help on using the repository browser.