It is something that is generally recommended to avoid. Primary reason: You could end up causing a name collision with a property that might be implemented in the DOM in the future. So, even if the code does not cause any problems today, it may come up in the future.
Another thing is that this is half way to later on you feel like extending the DOM, that is, extending the prototypes of native DOM objects as
HTMLElement
. This is not a good idea as these objects are much more susceptible to peculiarities that vary by implementation - and it is the very specification of the language that
gives this freedom to implementors of so called host objects .
For more details on all of this, the great reference is the following Kangax article: Although the article is from 2010, when the browser landscape was different, the language specification has not changed (yet), so much of what is said there is still valid - except, perhaps, for specific performance and bug analyzes of particular browsers.