Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selectorTree.walkPseudos(pseudoNode => {
const { value } = pseudoNode
if (!isStandardSyntaxSelector(value)) { return }
// Ignore pseudo-elements
if (value.slice(0, 2) === "::") { return }
if (optionsMatches(options, "ignorePseudoClasses", pseudoNode.value.slice(1))) { return }
const name = value.slice(1)
if (
vendor.prefix(name)
|| pseudoClasses.has(name.toLowerCase())
|| pseudoElements.has(name.toLowerCase())
) { return }
report({
message: messages.rejected(value),
node: rule,
index: pseudoNode.sourceIndex,
ruleName,
result,
})
})
})
_proto.parentPrefix = function parentPrefix(node) {
var prefix;
if (typeof node._autoprefixerPrefix !== 'undefined') {
prefix = node._autoprefixerPrefix;
} else if (node.type === 'decl' && node.prop[0] === '-') {
prefix = vendor.prefix(node.prop);
} else if (node.type === 'root') {
prefix = false;
} else if (node.type === 'rule' && node.selector.indexOf(':-') !== -1 && /:(-\w+-)/.test(node.selector)) {
prefix = node.selector.match(/:(-\w+-)/)[1];
} else if (node.type === 'atrule' && node.name[0] === '-') {
prefix = vendor.prefix(node.name);
} else {
prefix = this.parentPrefix(node.parent);
}
if (Browsers.prefixes().indexOf(prefix) === -1) {
prefix = false;
}
node._autoprefixerPrefix = prefix;
return node._autoprefixerPrefix;
_proto.parentPrefix = function parentPrefix(node) {
var prefix;
if (typeof node._autoprefixerPrefix !== 'undefined') {
prefix = node._autoprefixerPrefix;
} else if (node.type === 'decl' && node.prop[0] === '-') {
prefix = vendor.prefix(node.prop);
} else if (node.type === 'root') {
prefix = false;
} else if (node.type === 'rule' && node.selector.includes(':-') && /:(-\w+-)/.test(node.selector)) {
prefix = node.selector.match(/:(-\w+-)/)[1];
} else if (node.type === 'atrule' && node.name[0] === '-') {
prefix = vendor.prefix(node.name);
} else {
prefix = this.parentPrefix(node.parent);
}
if (!Browsers.prefixes().includes(prefix)) {
prefix = false;
}
node._autoprefixerPrefix = prefix;
return node._autoprefixerPrefix;
parentPrefix (node) {
let prefix
if (typeof node._autoprefixerPrefix !== 'undefined') {
prefix = node._autoprefixerPrefix
} else if (node.type === 'decl' && node.prop[0] === '-') {
prefix = vendor.prefix(node.prop)
} else if (node.type === 'root') {
prefix = false
} else if (
node.type === 'rule' &&
node.selector.includes(':-') &&
/:(-\w+-)/.test(node.selector)
) {
prefix = node.selector.match(/:(-\w+-)/)[1]
} else if (node.type === 'atrule' && node.name[0] === '-') {
prefix = vendor.prefix(node.name)
} else {
prefix = this.parentPrefix(node.parent)
}
if (!Browsers.prefixes().includes(prefix)) {
prefix = false
const unprefixedReports = reports.filter(({ node }) => {
switch (node.type) {
case 'atrule':
return !vendor.prefix(node.name);
case 'decl':
return !vendor.prefix(node.prop) && !vendor.prefix(node.value);
default:
return false;
}
});
_proto.cleanFromUnprefixed = function cleanFromUnprefixed(params, prefix) {
var _this4 = this;
var remove = params.map(function (i) {
return _this4.findProp(i);
}).filter(function (i) {
return i.slice(0, prefix.length) === prefix;
}).map(function (i) {
return _this4.prefixes.unprefixed(i);
});
var result = [];
for (var _iterator10 = _createForOfIteratorHelperLoose(params), _step10; !(_step10 = _iterator10()).done;) {
var param = _step10.value;
var prop = this.findProp(param);
var p = vendor.prefix(prop);
if (!remove.includes(prop) && (p === prefix || p === '')) {
result.push(param);
}
}
return result;
}
/**
for (var _iterator10 = params, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
var _ref9;
if (_isArray10) {
if (_i10 >= _iterator10.length) break;
_ref9 = _iterator10[_i10++];
} else {
_i10 = _iterator10.next();
if (_i10.done) break;
_ref9 = _i10.value;
}
var param = _ref9;
var prop = this.findProp(param);
var p = vendor.prefix(prop);
if (!remove.includes(prop) && (p === prefix || p === '')) {
result.push(param);
}
}
return result;
}
/**
for (var _iterator10 = params, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
var _ref9;
if (_isArray10) {
if (_i10 >= _iterator10.length) break;
_ref9 = _iterator10[_i10++];
} else {
_i10 = _iterator10.next();
if (_i10.done) break;
_ref9 = _i10.value;
}
var param = _ref9;
var prop = this.findProp(param);
var p = vendor.prefix(prop);
if (!remove.includes(prop) && (p === prefix || p === '')) {
result.push(param);
}
}
return result;
}
/**
var _loop = function _loop(prefix) {
var value = decl._autoprefixerValues[prefix];
if (value === decl.value) {
return 'continue';
}
var item = void 0;
var propPrefix = vendor.prefix(prop);
if (propPrefix === '-pie-') {
return 'continue';
}
if (propPrefix === prefix) {
item = decl.value = value;
result.push(item);
return 'continue';
}
var prefixed = prefixes.prefixed(prop, prefix);
var rule = decl.parent;
if (!rule.every(function (i) {
return i.prop !== prefixed;