Question about JavaScript design habit I know JavaScript pretty well, but still my class-like objects get pretty scrambled if I try to encapsulate too much into them. So I've ended up with a habbit. I create an object that has most of the dom's api stuff in it. For an over-simplistic example:

`var API = {breaking : document.getElementsByClassName('bad')};
function SomeClass() {API.breaking.addEventListener('click', this.foo)}`

So is this good practice?