You'd have better luck in https://discourse.wicg.io than here. This is about the ECMAScript spec and JavaScript the language, not anything related to the web platform at large.
On Tue, Sep 24, 2019 at 09:55 Randy Buchholz <[email protected]> wrote: > I’m putting a custom element in a template and then “selecting” it out to > Window level. It seem to loose its identity as a custom element. > > > > ``` > > // In page > > <template id="holder"> > > <my-element field="A"></my-element> > > </template> > > > > <script type="module"> > > class MyElement extends HTMLElement { > > constructor() { > > super(); > > } > > get Field() { return this.getAttribute("field");} > > } > > > > window.customElements.define("my-element", MyElement); > > </script> > > > > <script> > > const frag = document.querySelector("#holder").content; > > const el = frag.querySelector("my-element"); > > console.log({el}); > > </script> > > ``` > > > > When `<my-element>` is a page level and not in a template I can read > `xxx.Field`. When it comes from within a template it seems to no longer act > like the custom element – xxx.Field isn’t defined. The script selecting it > is at “Window” level, so shouldn’t it “cast” correctly? > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > -- ----- Isiah Meadows [email protected] www.isiahmeadows.com
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

