Skip to content

Commit b21a594

Browse files
committed
chore: Address code review comments.
1 parent 25329a2 commit b21a594

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/@css-blocks/core/src/BlockParser/block-intermediates.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { assertNever } from "@opticss/util";
22
import { CompoundSelector, postcssSelectorParser as selectorParser } from "opticss";
33

4-
import { ATTR_PRESENT, AttrToken, ROOT_CLASS } from "../BlockSyntax";
4+
import { ATTR_PRESENT, AttrToken, RESERVED_NAMESPACES, ROOT_CLASS } from "../BlockSyntax";
55
import { AttrValue, Block, BlockClass } from "../BlockTree";
66

77
export enum BlockType {
@@ -114,16 +114,13 @@ export function isRootNode(node: unknown): node is selectorParser.Pseudo {
114114

115115
export const isClassNode = selectorParser.isClassName;
116116

117-
export const RESERVED_NAMESPACES = new Set<string | undefined | true>(["html", "math", "svg"]);
118-
Object.freeze(RESERVED_NAMESPACES);
119-
120117
/**
121118
* Check if given selector node is an attribute selector
122119
* @param node The selector to test.
123120
* @return True if attribute selector, false if not.
124121
*/
125122
export function isAttributeNode(node: selectorParser.Node): node is selectorParser.Attribute {
126-
return selectorParser.isAttribute(node) && !RESERVED_NAMESPACES.has(node.namespace);
123+
return selectorParser.isAttribute(node) && node.namespace !== true && !RESERVED_NAMESPACES.has(node.namespace);
127124
}
128125

129126
/**

packages/@css-blocks/core/src/BlockParser/features/assert-foreign-global-attribute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function assertForeignGlobalAttribute(configuration: Configuration,
3737

3838
for (let node of sel.nodes) {
3939

40-
if ( node.type === selectorParser.PSEUDO && node.value === ROOT_CLASS) { continue; }
40+
if (node.type === selectorParser.PSEUDO && node.value === ROOT_CLASS) { continue; }
4141

4242
// If selecting something other than an attribute on external attribute, throw.
4343
if (!isAttributeNode(node)) {

0 commit comments

Comments
 (0)