Skip to content

Commit

Permalink
made queryableSelector work
Browse files Browse the repository at this point in the history
  • Loading branch information
avigoldman committed Nov 6, 2017
1 parent fd97096 commit b05fbc7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/heml-parse/src/preprocessStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,13 @@ function buildTheElementSpecificSelector(elementName, selector, $) {
return appendElementSelector(elementName, stringifySelectorNodes(nodes.reverse()))
}

function queryableSelector(s) {
return s
function queryableSelector(selector) {
const { nodes } = first(parseSelector(selector).nodes)

/** remove all non-static pseudo selectors/elements */
return stringifySelectorNodes(nodes.filter((node) => {
return !(node.type.startsWith('pseudo') && !staticPseudoSelectors.includes(node.name))
}))
}

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

if (node.type === 'tag') { return true }
if (node.type === 'element') { return true }
}
}

Expand Down

0 comments on commit b05fbc7

Please sign in to comment.