Behavior of find and findAll
See original GitHub issueShould find
and findAll
return all nodes including the root node, or excluding the root node
Including root node:
const compiled = compileToFunctions('<div><div /></div>')
const wrapper = mount(compiled).findAll('div').length // 2
excluding root node:
const compiled = compileToFunctions('<div><div /></div>')
const wrapper = mount(compiled).findAll('div').length // 1
I think it should exclude the root node, but would be interested to hear others thoughts
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Different behavior between re.finditer and re.findall
But finditer and findall are finding different things. Findall indeed finds all the matches in the given string. But finditer only finds the...
Read more >Python re.findall() – Everything You Need to Know - Finxter
This article is all about the findall() method of Python's re library. The findall() method is the most basic way of using regular...
Read more >Beautiful Soup documentation - Crummy
The basic find method: findAll(name, attrs, recursive, text, limit, **kwargs). Searching by CSS class; Calling a tag is like calling findall.
Read more >Python Regular Expressions - Google Developers
findall () is probably the single most powerful function in the re module. Above we used re.search() to find the first match for...
Read more >Strange behavior of Find All in Current Document with ...
The search string now has \n inserted into it, and the Search Mode has been changed! This, of course, is why there are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 to including the root node: if the root node is returned and the user wasn’t expecting it to, it’s clear what happened and easy to work around, while it’s less obvious the other way round.
@Austio I don’t think we should add an extra find method. Two is enough.
I thought about it this weekend and I agree with @yyx990803 . We should include the root node, in every
find
andfindAll
call.