[<<][webdev][>>][..]
Sat Jun 17 11:14:44 EDT 2017

DOM elements as objects

I like the ReactJS component idea.  Can this be approximated using
actual DOM elements and associated behavior?

As an example, take an SVG that needs to be animated somehow.
The SVG DOM element can be retrieved by:

document.getElementById('my-svg')

To use this as the state of an object, some data would need to be
stored in it.  From browsing the web I learn this is OK apparently,
just a little dirty and old school...

https://stackoverflow.com/questions/427262/can-i-just-make-up-attributes-on-my-html-tags

Bottom line, prefix with "data-" to be HTML5 compliant.

To identify an object, the "id" attribute is fine.

https://www.w3schools.com/tags/att_global_data.asp




[Reply][About]
[<<][webdev][>>][..]