Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What type of objects are the DOM objects?

Tags:

javascript

dom

Are DOM objects regular Javascript objects? If not, what are they?

like image 608
DuduAlul Avatar asked Nov 21 '25 18:11

DuduAlul


1 Answers

Does the DOM objects are reguler Javascript objects? if not, what are they?

No, they're "host objects". They don't necessarily play by all the same rules as native JavaScript objects.

They're in some sense objects, but they're added by the host environment and are not part of the ECMAScript specification.

For example, I don't believe there's anything that requires them to accept expando properties. Or in the case of functions, I don't know that they're required to have an accessible and extendable prototype property.

Also functions may or may not have the typical methods of Function.prototype, like .call() and .apply().

The rules are simply much looser than those of objects defined by the ECMAScript specification, so you can't necessarily rely on the same behavior in all cases.

like image 60
cliffs of insanity Avatar answered Nov 23 '25 06:11

cliffs of insanity



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!