Skip to content

Does htmlNode only extend certain document object functions? #160

Answered by ZuperZee
psheehymn asked this question in Q&A
Discussion options

You must be logged in to vote

htmlNode is a ShadowRoot https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot
It inherets DocumentFragment https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment

To get classNames from the htmlNode you can use querySelectorAll from the DocumentFragment https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll

htmlNode.querySelectorAll(".class-name")

Or use a child element that has the getElementsByClassName function https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName.

htmlNode.lastChild.getElementsByClassName("class-name")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@psheehymn
Comment options

Answer selected by psheehymn
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