Skip to content

Commit b05fbc7

Browse files
committed
made queryableSelector work
1 parent fd97096 commit b05fbc7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/heml-parse/src/preprocessStyles.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,13 @@ function buildTheElementSpecificSelector(elementName, selector, $) {
134134
return appendElementSelector(elementName, stringifySelectorNodes(nodes.reverse()))
135135
}
136136

137-
function queryableSelector(s) {
138-
return s
137+
function queryableSelector(selector) {
138+
const { nodes } = first(parseSelector(selector).nodes)
139+
140+
/** remove all non-static pseudo selectors/elements */
141+
return stringifySelectorNodes(nodes.filter((node) => {
142+
return !(node.type.startsWith('pseudo') && !staticPseudoSelectors.includes(node.name))
143+
}))
139144
}
140145

141146
/**
@@ -149,7 +154,7 @@ function targetsTag (selector) {
149154
for (const node of nodes) {
150155
if (node.type === 'operator' || node.type === 'spacing') { return false }
151156

152-
if (node.type === 'tag') { return true }
157+
if (node.type === 'element') { return true }
153158
}
154159
}
155160

0 commit comments

Comments
 (0)