feat: add a way to globally ignore CSS attributes

This commit is contained in:
Eduardo Speroni
2023-09-21 18:41:36 -03:00
committed by Nathan Walker
parent 3a7d6c7352
commit 150f623d65
2 changed files with 5 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ export namespace CSSUtils {
export const CLASS_PREFIX = 'ns-';
export const MODAL_ROOT_VIEW_CSS_CLASS = `${CLASS_PREFIX}${MODAL}`;
export const ROOT_VIEW_CSS_CLASS = `${CLASS_PREFIX}${ROOT}`;
export const IgnoredCssDynamicAttributeTracking = new Set<string>();
export function getSystemCssClasses(): string[] {
return cssClasses;

View File

@@ -4,6 +4,7 @@ import { isNullOrUndefined } from '../../utils/types';
import * as ReworkCSS from '../../css';
import { Combinator as ICombinator, SimpleSelectorSequence as ISimpleSelectorSequence, Selector as ISelector, SimpleSelector as ISimpleSelector, parseSelector } from '../../css/parser';
import { CSSUtils } from '../../css/system-classes';
/**
* An interface describing the shape of a type on which the selectors may apply.
@@ -675,6 +676,9 @@ export class SelectorsMatch<T extends Node> implements ChangeAccumulator {
public selectors: SelectorCore[];
public addAttribute(node: T, attribute: string): void {
if (CSSUtils.IgnoredCssDynamicAttributeTracking.has(attribute)) {
return;
}
const deps: Changes = this.properties(node);
if (!deps.attributes) {
deps.attributes = new Set();