You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling getTextRecursively() on an Element always returns an empty string. That is to be expected since it uses getChildren() for recursive traversal, however that method only returns Elements, so a Text node is never found and thus no text is discovered.
The text was updated successfully, but these errors were encountered:
Perhaps I'm wrong and Element can in fact be a Textual node. Regardless, I have an Element whose toString() says <template class="header"> Name </template> (it's basically Grid's header made sortable), but calling getTextRecursively() on this element returns an empty string.
We have a bunch of tests in com.vaadin.flow.dom.ElementTest that assert that getTextRecursively() returns various non-empty values.
The reason in your case is most likely that the <template> element is configured with an innerHTML property instead of having a proper text node child. <template> elements work in a special way in the browser, so regular child elements are ignored. We must instead pass the contents as innerHTML to make it work.
Calling
getTextRecursively()
on an Element always returns an empty string. That is to be expected since it usesgetChildren()
for recursive traversal, however that method only returns Elements, so a Text node is never found and thus no text is discovered.The text was updated successfully, but these errors were encountered: