DEV Community

Discussion on: Let's Build a Colour Picker Web Component

Collapse
 
dannyengelman profile image
Danny Engelman

Cool... but I am the laziest developer ever... drop the this in this:

super()
    this
      .attachShadow({ mode: 'open' })
      .append(template.content.cloneNode(true));
Enter fullscreen mode Exit fullscreen mode
super() // sets and returns this
      .attachShadow({ mode: 'open' })
      .append(template.content.cloneNode(true));
Enter fullscreen mode Exit fullscreen mode
Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

fine, but if you copy that into a typescript file, it will break everything.

That's not a criticism of your change as much as it's a criticism of typescript, though. Still, it bears saying.

Collapse
 
dannyengelman profile image
Danny Engelman • Edited

LOL, that is the drawback of me not using TypeScript (any more). I don't learn where it fails.
Even more LOL to consider I worked in the Microsoft world for 15 years;
and "nudged" my Typescript colleagues unlearn ES3 patterns they applied to cool new TypeScript:
Clark Kents' TypeScript Adventures