Nathan Knowler on Nostr: Write your custom element’s JS in such a way that when the declarative form of ...
Write your custom element’s JS in such a way that when the declarative form of custom elements show up you get to delete all or most of your code (or keep it around as a polyfill). How do you do that? Pay close attention to how HTML elements work and keep the weird shit to a minimum. The weird shit is your tech debt that the web platform isn’t going to forgive you for.
Until then your custom element is a progressive enhancement for something else. And remember that’s not about providing the same experience, but an equitable one. When you start with a base experience that’s proven to work, sometimes you realize you don’t need an enhanced one. Win-win.
#WebComponents #ProgressiveEnhancement
Published at
2024-05-31 02:39:05Event JSON
{
"id": "3ec7fe7a8e13beb2a8043b630b23d8a0fb004efd048cb7876d74f7ccd8b6d0b9",
"pubkey": "f29a4060dfdefb8809dd64eda7a8e1d89e7bd98040a1b82b9a1925378c158146",
"created_at": 1717123145,
"kind": 1,
"tags": [
[
"t",
"WebComponents"
],
[
"proxy",
"https://sunny.garden/@knowler/112533382495520893",
"web"
],
[
"t",
"progressiveenhancement"
],
[
"proxy",
"https://sunny.garden/users/knowler/statuses/112533382495520893",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://sunny.garden/users/knowler/statuses/112533382495520893",
"pink.momostr"
]
],
"content": "Write your custom element’s JS in such a way that when the declarative form of custom elements show up you get to delete all or most of your code (or keep it around as a polyfill). How do you do that? Pay close attention to how HTML elements work and keep the weird shit to a minimum. The weird shit is your tech debt that the web platform isn’t going to forgive you for.\n\nUntil then your custom element is a progressive enhancement for something else. And remember that’s not about providing the same experience, but an equitable one. When you start with a base experience that’s proven to work, sometimes you realize you don’t need an enhanced one. Win-win.\n\n#WebComponents #ProgressiveEnhancement",
"sig": "1566d06f6aabc62eab5d274888f0c86afe800978630824fd7fb744074b07aecccd64b4f80c16fecc90e42d0712c2d62866a49530c725d6bfacf3933d5249c002"
}