Web Components and Types it’s Includes in LWC : jayakrishnasfdc

Web Components and Types it’s Includes in LWC
by: jayakrishnasfdc
blow post content copied from  Jayakrishna Ganjikunta
click here to view original post


First of all lets understand what is Web component and advantages over custom component in Aura.

Web component: is a custom html templates which has ability to import html elements and work in shadow DOM and native web standards .

Problems of custom component model:

  • lack of native reusable components
  • lack of style isolation
  • lack of native templating in HTML
  • lack of a way of packaging css, javascript and html together (as a component)
  • lack of custom elements

Web components are built using 4 technologies:

  • Templates
  • Custom Elements
  • Shadow DOM
  • HTML 5 Imports
  1. Templates

Up until now, we have used unorthodox and unsafe ways to implement client side templates in HTML, like the common <script type=”text/html”>, <script type=”text/mytype“> or hidden elements.

HTML templates are:

insert, the markup within a template tag is not rendered nor is evaluated by the browser,

hidden for selectors, the markup within a template is not part of the DOM and thus is hidden from selectors. The only way to access the contents within a template are the template APIs, •they can be placed anywhere within a page

2. Custom Elements

By providing the ability to create custom elements, the custom element standard allows you to define markup with the appropriate semantics for your application.

Advantages:

•Increases the readability of your application ( and thus speed of development and maintainability)

•Improves SEO

•Improves accessibility

3. Shadow DOM

Shadow DOM refers to the ability of the browser to include a subtree of DOM elements into the rendering of a document, but not into the main document DOM tree.

4. HTML 5 Imports: we can import elements from Html Libraries.

Check Full LWC Course ==> Click here

Thanks
Jayakrishna

Facebook Page: Jayakrishna sfdc Blog – https://www.facebook.com/groups/615517438930811/

Twitter: https://twitter.com/jayakrishnadoc

Blog/website:  https://jayakrishnasfdc.wordpress.com


November 29, 2020 at 02:44PM
Click here for more details...

=============================
The original post is available in Jayakrishna Ganjikunta by jayakrishnasfdc
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce