Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
root.walkDecls(decl => {
if (
!isStandardSyntaxDeclaration(decl)
|| !isStandardSyntaxProperty(decl.prop)
) { return }
const { prop, value } = decl
const normalizedProp = vendor.unprefixed(prop.toLowerCase())
// Ignore not shorthandable properties, and math operations
if (
isIgnoredCharacters(value)
|| !shorthandableProperties.has(normalizedProp)
|| ignoredShorthandProperties.has(normalizedProp)
) { return }
const valuesToShorthand = []
valueParser(value).walk((valueNode) => {
if (valueNode.type !== "word") { return }
valuesToShorthand.push(valueParser.stringify(valueNode))
})
_proto.unprefixed = function unprefixed(prop) {
var value = this.normalize(vendor.unprefixed(prop));
if (value === 'flex-direction') {
value = 'flex-flow';
}
return value;
}
/**
root.walkDecls(decl => {
const { prop } = decl
if (!isStandardSyntaxProperty(prop)) { return }
if (isCustomProperty(prop)) { return }
if (!matchesStringOrRegExp(vendor.unprefixed(prop), blacklist)) { return }
report({
message: messages.rejected(prop),
node: decl,
result,
ruleName,
})
})
}
_proto.prefixed = function prefixed(prop, prefix) {
prop = vendor.unprefixed(prop);
return this.decl(prop).prefixed(prop, prefix);
}
/**
valueParser(value).walk(function (node) {
if (node.type !== "function") { return }
if (!isStandardSyntaxFunction(node)) { return }
if (matchesStringOrRegExp(vendor.unprefixed(node.value).toLowerCase(), whitelist)) { return }
report({
message: messages.rejected(node.value),
node: decl,
index: declarationValueIndex(decl) + node.sourceIndex,
result,
ruleName,
})
})
})
const getPartialValueUnsupported = (context: Identifier, value: string, browsers: string[]): UnsupportedBrowsers | null => {
const prefix = vendor.prefix(value);
const unprefixedValue = vendor.unprefixed(value);
const tokens = getTokens(valueParser(value).nodes);
for (const entry of Object.values(context)) {
const matches = entry.__compat && entry.__compat.matches;
if (!matches) {
continue;
}
if (matches.regex_value && new RegExp(matches.regex_value).exec(unprefixedValue)) {
return getUnsupportedBrowsers(entry, prefix, browsers, unprefixedValue);
}
if (matches.keywords) {
for (const [tokenPrefix, tokenValue] of tokens) {
_proto.unprefixed = function unprefixed(prop) {
var value = this.normalize(vendor.unprefixed(prop));
if (value === 'flex-direction') {
value = 'flex-flow';
}
return value;
}
/**
unprefixed (prop) {
let value = this.normalize(vendor.unprefixed(prop))
if (value === 'flex-direction') {
value = 'flex-flow'
}
return value
}
_proto.unprefixed = function unprefixed(prop) {
var value = this.normalize(vendor.unprefixed(prop));
if (value === 'flex-direction') {
value = 'flex-flow';
}
return value;
}
/**
Prefixes.prototype.prefixed = function prefixed(prop, prefix) {
prop = vendor.unprefixed(prop);
return this.decl(prop).prefixed(prop, prefix);
};