Skip to content

Commit

Permalink
Add 'host' and 'host-context' to unpackPseudo so that data inside the…
Browse files Browse the repository at this point in the history
…m can be parsed
  • Loading branch information
zicsus authored and fb55 committed Sep 24, 2020
1 parent bf7068e commit f835363
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/__fixtures__/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,31 @@ export const tests: [string, Selector[][], string][] = [
],
"multiple selectors",
],

[
':host(h1, p)',
[
[
{
type: "pseudo",
name: "host",
data: [
[
{
"type":"tag",
"name":"h1"
}
],
[
{
"type":"tag",
"name":"p"
}
]
]
},
],
],
"pseudo selector with data",
]
];
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const attribSelectors: { [key: string]: [string, AttributeAction] } = {
};

// Pseudos, whose data property is parsed as well.
const unpackPseudos = new Set(["has", "not", "matches", "is"]);
const unpackPseudos = new Set(["has", "not", "matches", "is", "host", "host-context"]);

const stripQuotesFromPseudos = new Set(["contains", "icontains"]);

Expand Down

0 comments on commit f835363

Please sign in to comment.