gorgeous-ghost-95789
10/22/2020, 5:55 PMgorgeous-ghost-95789
10/22/2020, 5:55 PMthankful-addition-60522
10/22/2020, 5:58 PMhtml
<target>
<style>target > *{color:red;}</style> // scoped
<b>i'm a target</b>
<script>alert('target');</script> //scoped?
</target>
2. mount it
js
tag.mount('target',{
html: "<b>123</b>",
params: {
param1: "value",
param2: "value"
}
});
3. render itthankful-addition-60522
10/22/2020, 6:01 PMhtml
<shelf>
<item color="red"/>
<item color="green"/>
<item color="blue"/>
</shelf>
gorgeous-ghost-95789
10/22/2020, 6:30 PMthankful-addition-60522
10/22/2020, 8:18 PMthankful-addition-60522
10/22/2020, 8:19 PMgorgeous-ghost-95789
10/22/2020, 8:45 PMgorgeous-ghost-95789
10/22/2020, 8:46 PMgorgeous-ghost-95789
10/22/2020, 8:48 PMinit()
functions for specific client-side component library du jour.thankful-addition-60522
10/22/2020, 9:48 PMthankful-addition-60522
10/22/2020, 9:49 PMstrong-guitar-63405
10/22/2020, 9:52 PM<date-picker hx-post="/clicked" hx-swap="outerHTML">Click Me</date-picker>
And there are many ways to leverage web components: https://webcomponents.dev
Browser support isn’t perfect, but it’s pretty good these days.thankful-addition-60522
10/22/2020, 9:55 PMgorgeous-ghost-95789
10/22/2020, 10:06 PMgorgeous-ghost-95789
10/22/2020, 10:07 PMgorgeous-ghost-95789
10/22/2020, 10:10 PMgorgeous-ghost-95789
10/22/2020, 10:11 PMthankful-addition-60522
10/22/2020, 10:11 PMthankful-addition-60522
10/22/2020, 10:12 PMgorgeous-ghost-95789
10/22/2020, 10:16 PMstrong-guitar-63405
10/22/2020, 10:20 PMstrong-guitar-63405
10/22/2020, 10:22 PMgorgeous-ghost-95789
10/22/2020, 10:23 PMgorgeous-ghost-95789
10/22/2020, 10:23 PMstrong-guitar-63405
10/22/2020, 10:28 PMgorgeous-ghost-95789
10/22/2020, 10:29 PMgorgeous-ghost-95789
10/22/2020, 10:30 PMthankful-addition-60522
10/22/2020, 10:30 PMstrong-guitar-63405
10/22/2020, 10:35 PM