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

Does not handle elements detached from DOM #20

Open
jklmli opened this issue Feb 3, 2017 · 3 comments
Open

Does not handle elements detached from DOM #20

jklmli opened this issue Feb 3, 2017 · 3 comments

Comments

@jklmli
Copy link

jklmli commented Feb 3, 2017

If an element has already been detached from the DOM, this throws an exception in testUniqueness, which assumes that parentNode always exists.

@jasan-s
Copy link

jasan-s commented Jun 30, 2019

having the same issue here. @jiaweihli did you solve this? im using it in react and i am using some ternary expression to render components and it throws that error when certain elements are removed from dom.

@jasan-s
Copy link

jasan-s commented Jun 30, 2019

@jiaweihli its def been a while but this PR resolves the issue #39

@tathastu871
Copy link

tathastu871 commented Oct 27, 2024

const elements = parentNode?.querySelectorAll( CSS.escape(selector) )
return elements?.length === 1 && elements[ 0 ] === element;
}

Use ?.Will Work as if parentNode not available

also instead of selector use CSS.escape(selector)

It will automatiackly escapes spevial chrcaters like . whitespace % t etc etc from id and class

No need of if statememy

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

3 participants