Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* supported everywhere `theme-color` is. Also, values
* such as `currentcolor` don't make sense, but they
* will be catched by the above check.
*
* See also:
*
* * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Browser_compatibility
* * https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/graphics/Color.cpp?rcl=6263bcf0ec9f112b5f0d84fc059c759302bd8c67
*/
// TODO: Use `isSupported` for all color syntax checks.
// `RGBA` support depends on the browser.
return (color.model === 'rgb' &&
hexWithAlphaRegex.test(normalizedColorValue) &&
!isSupported({ property: 'color', value: '#00000000' }, context.targetedBrowsers)) ||
// `HWB` is not supported anywhere (?).
color.model === 'hwb';
};
* supported everywhere `theme-color` is. Also, values
* such as `currentcolor` don't make sense, but they
* will be catched by the above check.
*
* See also:
*
* * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Browser_compatibility
* * https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/graphics/Color.cpp?rcl=6263bcf0ec9f112b5f0d84fc059c759302bd8c67
*/
// TODO: Use `isSupported` for all color syntax checks.
// `RGBA` support depends on the browser.
return (color.model === 'rgb' &&
hexWithAlphaRegex.test(normalizedColorValue) &&
!isSupported({ property: 'color', value: '#00000000' }, context.targetedBrowsers)) ||
// `HWB` is not supported anywhere (?).
color.model === 'hwb';
};
!elementHrefHasRequiredProtocol(element) ||
!checkSameOrigin(resource, element)) {
return;
}
checkForRelValue(resource, element, 'noopener', Severity.error);
/*
* If no browsers were targeted, or `noopener`
* is not supported by all targeted browsers,
* also check for 'noreferrer'.
*/
// TODO: Fix `isSupported` so `element` can be `a`.
if (!context.targetedBrowsers.length || !isSupported({ attribute: 'rel', element: 'link', value: 'noopener' }, context.targetedBrowsers)) {
checkForRelValue(resource, element, 'noreferrer', Severity.warning);
}
};