Revert "skip malformed css selector" (#3578)

This commit is contained in:
pedrohsdb
2025-10-01 11:38:07 -07:00
committed by GitHub
parent 0fce84a384
commit 80c7ea2577

View File

@@ -763,11 +763,7 @@ function isHoverPointerElement(element, hoverStylesMap) {
} }
} }
if (shouldMatch || selector.includes(tagName)) { if (shouldMatch || selector.includes(tagName)) {
if ( if (element.matches(selector) && styles.cursor === "pointer") {
isValidCSSSelector(selector) &&
element.matches(selector) &&
styles.cursor === "pointer"
) {
return true; return true;
} }
} }
@@ -2196,11 +2192,6 @@ async function getHoverStylesMap() {
// Get base selector without :hover // Get base selector without :hover
const baseSelector = hoverPart.replace(/:hover/g, "").trim(); const baseSelector = hoverPart.replace(/:hover/g, "").trim();
// Skip invalid CSS selectors
if (!isValidCSSSelector(baseSelector)) {
continue;
}
// Get or create styles object for this selector // Get or create styles object for this selector
let styles = hoverMap.get(baseSelector) || {}; let styles = hoverMap.get(baseSelector) || {};
@@ -2213,8 +2204,6 @@ async function getHoverStylesMap() {
// store it in a special format // store it in a special format
if (parts.length > 1) { if (parts.length > 1) {
const fullSelector = selector; const fullSelector = selector;
// Skip if the full selector is invalid
if (isValidCSSSelector(fullSelector)) {
styles["__nested__"] = styles["__nested__"] || []; styles["__nested__"] = styles["__nested__"] || [];
styles["__nested__"].push({ styles["__nested__"].push({
selector: fullSelector, selector: fullSelector,
@@ -2223,7 +2212,6 @@ async function getHoverStylesMap() {
), ),
}); });
} }
}
// only need the style which includes the cursor attribute. // only need the style which includes the cursor attribute.
if (!("cursor" in styles)) { if (!("cursor" in styles)) {