Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastSlice is not defined in noqsa line 846 #109

Closed
nrkn opened this issue Sep 27, 2017 · 2 comments
Closed

lastSlice is not defined in noqsa line 846 #109

nrkn opened this issue Sep 27, 2017 · 2 comments

Comments

@nrkn
Copy link

nrkn commented Sep 27, 2017

https://github.com/dperini/nwmatcher/blob/master/src/nwmatcher-noqsa.js#L846

Confirmed in both browser, and node.js+jsdom

This is the smallest I could get it down to:

const el1 = document.createDocumentFragment()
const child1 = document.createElement( 'div' )
el1.appendChild( child1 )

const el2 = document.createElement( 'section' )
const child2 = document.createElement( 'p' )
el2.appendChild( child2 )

first( 'span', el1 )
first( 'span', el2 )
  • throws TypeError: lastSlice is undefined on the second call to first - expected was returns null
  • el1 must be a document fragment
  • el1 and el2 must have at least one child
  • the same selector must be used on both
  • neither el2 nor the child elements' tagNames seem to matter
  • the selector doesn't seem to matter
@dperini
Copy link
Owner

dperini commented Sep 28, 2017

Acknowledge the bug ... thank you for reporting the issue.
A fix is on the way, also this bug did exist at least since 1.3.x so it was well hidden :)

dperini added a commit that referenced this issue Oct 1, 2017
@dperini
Copy link
Owner

dperini commented Oct 1, 2017

Fixed ! Doing some test before pushing to npm.
Thank you again for reporting.
👍

@dperini dperini closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants