concept DOM interaction in category javascript

appears as: DOM interaction
JavaScript Application Design: A Build First Approach

This is an excerpt from Manning's book JavaScript Application Design: A Build First Approach.

This is one way to keep data safe from consumers; many scenarios exist when data privatization isn’t necessary and where allowing consumers to manipulate your instance data might be a good thing. You should wrap all of this in a closure so your private data doesn’t leak out. I believe prototypes in JavaScript are most useful when dealing with DOM interaction, as we’ll investigate in chapter 7. That’s because when dealing with DOM objects, you usually have to work with many elements at the same time; prototypes improve performance because their methods aren’t replicated on each instance, saving resources.

Testing client-side code is typically a hassle because of both AJAX requests and DOM interaction. That, often paired with a complete lack of modularity and code organization, spells chaos for the client-side JavaScript test developer. That being said, in chapter 5 you resolved your browser modularity concerns by settling for Browserify. Browserify allows you to use self-contained CommonJS modules even in client-side code but at the cost of an extra build step.