No, Object is listed as part of the Javascript language , and the DOM is an API that is relevant only in the browser environment and is used to access and update the content, structure and style of documents " (W3C) .
However, one of the reasons given in this article, arguing that there is an extension of DOM objects, still refers to the extension of native types such as Object , namely, the probability of collisions.
An object wrap refers to creating a new object that references the original, but provides additional functions through a new shell object.
For example, instead of extending the DOM Element object using the addClass cross-browser addClass as follows:
var element = document.getElementById('someId'); element.addClass = function (className) { ... };
Instead, you can define a wrapper function:
var ElementWrapper = function (element) { this.element = element; };
And add the function to your prototype:
ElementWrapper.prototype.addClass = function (className) { ... };
And wrap the elements as follows:
var element = document.getElementById('someId'); var wrapped = new ElementWrapper(element); wrapped.addClass('someClass');
source share