Skip to content

Can't Find Elements in ChildContent #515

Answered by egil
thalaeg asked this question in Q&A
Discussion options

You must be logged in to vote

@thalaeg I think the problem is that you are using the <template> element. Content inside a template element is not added to the document object model (more about the tag here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template), and can thus not be found using Find or FindAll, both of which are shorthands for QuerySelector and QuerySelectorAll respectively, so that is why `Find("button") doesn't return an element.

That's not just a bUnit thing, it's also how it works in the browser, so you may be using the <template> element incorrectly in this case.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by egil
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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
Converted from issue

This discussion was converted from issue #512 on October 14, 2021 16:08.