开发者

Javascript List of Objects in IE<9 fail to inherit from Object.prototype

开发者 https://www.devze.com 2023-03-18 02:02 出处:网络
I understand Object.prototype shouldn\'t be altered, but out of curiosity, what are all of the objects that fail to inherit from Object.prototype in IE<9?

I understand Object.prototype shouldn't be altered, but out of curiosity, what are all of the objects that fail to inherit from Object.prototype in IE<9?

So far all of the following fail to inherit from Object.prototype.

  • alert
  • document.createElement
  • setTimeout
  • setInterval
  • document.createElement('i') - All other DOM elements
  • document.createElement('i').appendChild - All DOM element methods included
  • 开发者_JAVA百科

I've created a jsbin test here. All browsers should get success except well...IE.

http://jsbin.com/inuhux/7 - http://jsbin.com/inuhux/7/edit

What other objects in IE<9 fail to inherit from Object.prototype?


You should not assume that host objects inherit anything from built-in objects in any browser or user agent. There is no specification that says they must.

The W3C DOM specifications are all language neutral, they do not assume any specific language features. When they use the term "inherit" in regard to DOM interfaces, it means "this interface has all the features of some other interface", not that any kind of inheritance must be implemented.

Some browsers choose to implement them using prototype inheritance, but that is not required.


What do you mean alert is not inheriting from object and hasn't prototype:

 typeof alert; // "function"
 typeof alert.prototype; // "object"
0

精彩评论

暂无评论...
验证码 换一张
取 消