develwoutacause’s avatardevelwoutacause’s Twitter Archive—№ 1,726

  1. Cursed code snippets: #JavaScript custom elements edition. stackblitz.com/edit/typescript-2k5dgd?file=index.ts
    A screenshot of a TypeScript code snippet. This snippet declares a web component named `MyElement` with an optional property named `prop`. Then it creates a new `Document` with `document.implementation.createHTMLDocument()`. With that document, it creates a new `MyElement` and assigns the string 'test' to `prop`. Finally, the snippet appends this element to the main document and logs the value of `prop`. A typical user would expect this to log 'test', however a comment indicates that this line actually logs `undefined`.
    1. …in reply to @develwoutacause
      If you're curious to learn *how* this snippet is so cursed, take a look at this post which goes into detail on it.👇 @develwoutacause/1573688712059359232?s=20&t=SsRXtK8wPpdDjvawy1RrNQ