marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.02k stars 796 forks source link

Ch:14 Attributes about HTMLElement.dataset API #530

Closed rosald closed 4 years ago

rosald commented 4 years ago

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

marijnh commented 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.