mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
This also adds CC-BY-4.0 to the list of accepted licenses. DISABLE_THIRD_PARTY_CHECK=update dependencies Bug: chromium:1083142 Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
39 lines
737 B
JavaScript
39 lines
737 B
JavaScript
'use strict';
|
|
|
|
const hasInterpolation = require('../utils/hasInterpolation');
|
|
|
|
/**
|
|
* Check whether a selector is standard
|
|
*
|
|
* @param {string} selector
|
|
* @returns {boolean}
|
|
*/
|
|
module.exports = function (selector) {
|
|
// SCSS or Less interpolation
|
|
if (hasInterpolation(selector)) {
|
|
return false;
|
|
}
|
|
|
|
// SCSS placeholder selectors
|
|
if (selector.startsWith('%')) {
|
|
return false;
|
|
}
|
|
|
|
// Less :extend()
|
|
if (/:extend(\(.*?\))?/.test(selector)) {
|
|
return false;
|
|
}
|
|
|
|
// Less mixin with resolved nested selectors (e.g. .foo().bar or .foo(@a, @b)[bar])
|
|
if (/\.[\w-]+\(.*\).+/i.test(selector)) {
|
|
return false;
|
|
}
|
|
|
|
// ERB template tags
|
|
if (selector.includes('<%') || selector.includes('%>')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
};
|