Small regex fix for older browsers (#762)

This commit is contained in:
Cristi Constantin
2026-04-01 12:00:00 +08:00
committed by GitHub
parent d9333f675b
commit e4b48fbc2b
2 changed files with 2 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ function escapeRegExp(str: string) {
}
const HOVER_SELECTOR = /([^\\]):hover/;
const HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR, 'g');
const HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g');
export function addHoverClass(cssText: string, cache: BuildCache): string {
const cachedStyle = cache?.stylesWithHoverClass.get(cssText);
if (cachedStyle) return cachedStyle;

View File

@@ -16,7 +16,7 @@ import { isElement, isShadowRoot, maskInputValue } from './utils';
import { values } from 'puppeteer/DeviceDescriptors';
let _id = 1;
const tagNameRegex = RegExp('[^a-z0-9-_:]');
const tagNameRegex = new RegExp('[^a-z0-9-_:]');
export const IGNORED_NODE = -2;