Closed rosald closed 4 years ago
Hi. I chose not to include those—the DOM interface is extremely large, and I didn't want to bury people under a big list of method and property names. Since getAttribute
/setAttribute
are more general (can also manipulate non-data attributes) they seemed more important and enough for a beginner to start working with.
there is an HTMLElement.dataset API https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset which can read/write access to all the custom data attributes (data-*) set on the element.
in the book , it said'Instead, you have to use the getAttribute and setAttribute methods to work with them.' may be it is better to add these related content in the book
sorry to bother you