Object.prototype in JavaScript

后端 未结 2 644
遇见更好的自我
遇见更好的自我 2021-01-18 11:21

I have some JavaScript code that defines a function getElementsByAttribute as follows:

Object.prototype.getElementsByAttribute = function(attr)          


        
2条回答
  •  一个人的身影
    2021-01-18 11:59

    IE DOM elements aren't normal Javascript objects and do not inherit prototypes as you would expect.

    http://perfectionkills.com/whats-wrong-with-extending-the-dom/

提交回复
热议问题