Why does not DocumentFragment has getElementsByName?

I am following the instructions given on MDN to use <template>. Slightly different those give in example, my code is: However, it appears that item, of which the __proto__ is DocumentFragment has no getElementsByName method. Is it very confusing for me now that there is getElementById and querySelector. Is there any reason why? In case related, my browsers are FireFox Quantum 69.0.1 are Chrome Canary 79.0.3918.0. Answer DocumentFragment doesn’t implement any of the getElementsBy* methods. However, it does implement querySelector(), so you can use

Initialisation of Custom Elements Inside Document Fragment

Consider this HTML template with two flat x-elements and one nested. How to initialise (fire constructor) all custom elements in cloned from fooTemplate document fragment without appending it to DOM, neither by extending built-in elements with is=”x-element”; either entire fragment. Note that script executes with defer attribute. Answer We can initialise template with this arrow function: Or with this method defined on template prototype (I prefer this way): In any case in result this code will work fine: I’m not sure if these methods are the most effective way to initialise custom elements in template. Also note that there is