Skip to content

Does using within actually have any perf benefits? #1320

Answered by MatanBobi
hrmJ asked this question in Q&A
Discussion options

You must be logged in to vote

The only thing that happens in within is we're binding the queries to the element, so instead of using screen which will run document.body.querySelectorAll, we'll run element.querySelectorAll. I think it will have a performance impact only if the document.body is really, really big. I believe that within's purpose is not a performance boost rather than narrowing down the query to a specific area of a page.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MatanBobi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants