HTML standarden innehåller APIer som låter oss själva definiera nya typer av element
-
Custom Elements
- Egna attribut
- Child-element
- Styling baserat på internt state
-
Shadow DOM
- Låter oss dölja innanmätet av ett custom element från javascript och css
- För- och nackdelar
-
<template>- Låter oss definiera html-strukturen i ett custom element på ett smidigt sätt
-
<slot>- Låter oss välja vart child-element hamnar i html strukturen
...using custom elements
- A static version of the application
- Make the application dynamic by connecting the different parts
- Introduce dynamic content by fetching data from a backend
- Encapsulate the DOM structure
- Take control of DOM manipulation
- Allow a declarative way to provide the url
- Eliminate the need to know anything about the internal DOM structure outside of the menu
- Encapsulate the DOM structure
- Isolate the update logic