Closed milahu closed 4 years ago
same goes for div::before
and div:before
both selectors should use the same resolver
const baseSel = selector
.replace(/:?:(after|before|first-letter|first-line)/g, '');
backward compatibility is a pain ....
@milahu thank you so much for the suggestion and for the code change in the pull request. I will have a look and do a test cycle to make sure nothing breaks, then I will commit your request.
: ]
this issue is obsolete (full revoke), resolvers can not be reused they should match the pseudo element, not the base element
the old implementation was just a placeholder my proposed solution is in PR #40
edit: full revoke. see PR #40
edit: partial revoke: nwsapi does use different resolvers for base-element vs pseudo-element:
.... this condition is added for the selector
body>div::after
compared tobody>div
nodeType 1 is ELEMENT_NODE
node types in jsdom
```js module.exports = Object.freeze({ ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, // historical ENTITY_REFERENCE_NODE: 5, // historical ENTITY_NODE: 6, // historical PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12 // historical }); ```--
currently nwsapi compiles different resolvers for (base-) elements and pseudo-elements
for example it compiles two different resolvers for the selectors
div
anddiv::before
but it should compile only one resolver since all resolvers return the same (base-) element
so,
selectors
infunction _matches(selectors, element, callback)
should be processed with something likeor more verbose