Web Components

Web Components

Web Components have been stirring a quiet revolution in front-end development. Wrapped in a mysterious entity called 'the Shadow DOM' - what exactly does that mean?

It is not that difficult to understand.? Imagine a bread making machine. It has a group of functions that vary according to what you are making, but the essential controls direct the mixing device that kneads the dough, the heating element that cooks the loaf and ingredient release triggers that combine the yeast at the right moment. It is a group of components which together comprise a more complex machine.? Each component may have qualities that are unique to it, you do not want the heating element's properties to affect the yeast release mechanism or the movement of the mixing device to move the heating element.?

These unique properties in a web component could be div containers, or CSS settings. These settings can define a button, for example, what it looks like, its colour and events and how these colours may respond to various events.? You can hide these qualities in the 'Shadow DOM' of the component.? It is a self contained component, its settings are contained, private and its concerns are hidden from other components.

Think of Web Components like vehicles on the road.? Each contains a set of functionalities and yet can look different and carry different kinds of load. How do you make an effective highway with lots of different types of vehicles? By making the vehicles from the same principles, but allowing for variations by specifying attributes.? Web Components work like that.

The Shadow DOM prevents components from messing with each other.? The Shadow DOM is implemented in most browsers (excluding IE and Opera Mini).? Web Components are an extremely powerful tool for making content that has functionality, consistent design and most importantly, they can be reused.? A single webpage could have multiple instances of one or more components.? They implement new tags into and make HTML into an extensible language.??

Web Components can be implemented in Vanilla JS but using the 'lit' library makes more sense, it runs in the browser (the lit modules are a library, they do not require transpilation), is fast and more important, clarity helps make it easier to maintain. Or, they can be written using Typescript (that does require transpilation).

要查看或添加评论,请登录

Nicholas Alexander的更多文章

  • Cadence-CRM update

    Cadence-CRM update

    First of all, sorry. I got my days of the week mixed up and thought it was Monday again.

  • Live Demonstrations

    Live Demonstrations

    We are demonstrating improvements to Cadence-CRM on Wednesday 1pm online (UK time). You are most welcome to watch.

  • The Limits of AI

    The Limits of AI

    AI is limited. The way that you use it is not.

  • Cadence Clarity

    Cadence Clarity

    After I imported thousands of contacts from LinkedIn into Cadence-CRM as prospects, I realised that was a mistake. I…

  • Cadence-CRM Simplicity

    Cadence-CRM Simplicity

    Another update. More simplicity.

    4 条评论
  • Push Button Simplicity

    Push Button Simplicity

    When writing Cadence-CRM, my objective is that it deals with any complexity under the hood so that you, the coach - the…

    1 条评论
  • Remote working

    Remote working

    The human imagination is vast, our creativity is stimulated by knowing we are doing something we value. When we see a…

  • AI Magic

    AI Magic

    Is AI really thinking? Or is it an illusion? AI software development experience has taught me two things: It seems…

    2 条评论
  • The brutal facts

    The brutal facts

    Do you like to be hit with a sales pitch the moment you meet someone? Before you shake hands? We have all received…

    1 条评论
  • What is Cadence?

    What is Cadence?

    Cadence is the pulse, the rhythm of your business. The heartbeat.

    1 条评论

社区洞察

其他会员也浏览了