Re:HTML Attributes vs. DOM Properties
by jaffathecake on Thursday April 25, 2024 @04:44AM
(#40155024)
This means you couldn't non-string values on DOM interfaces, and that includes methods, so most of the DOM's functionality goes out the window.
[ Parent
| on HN ]
Good point, but HTML already has a workaround by using strings:
<div onClick="func()">...</div>
Now, I'm not a JS developer, so my opinion shouldn't count for much, but that looks like a much less usable standard to me.
Re:HTML Attributes vs. DOM Properties
by jaffathecake on Thursday April 25, 2024 @04:55AM
(#40155089)
Yeah, that works, but it requires func() to be on the global scope. It doesn't scale as a solution.
Does that matter now that we've got (possibly declarative) shadow roots as the units of DOM encapsulation?
Re:HTML Attributes vs. DOM Properties
by jaffathecake on Thursday April 25, 2024 @06:11AM
(#40155559)
Yes, even more so. You end up with encapsulated DOM without encapsulated script.