朋友,
我注意到在Firefoxv23.0.1中,hasOwnProperty of HTMLElement(输入,button..etc)不起作用,
button1.hasOwnProperty('id') = false我用in来检查:
var str1 = '';
for (pp in button1) {
if (button1.hasOwnProperty(pp)) {
str1 += (',' + pp);
}
}
alert(str1);//nothing here但是在铬hasOwnProperty中工作得很好。
你知道这是个窃听器吗?
发布于 2013-08-28 04:05:20
根据规范,"id“属性位于HTMLElement.prototype或Element.prototype上(取决于规范版本)。
Firefox正确地理解了这一点。Chrome将所有属性直接放在对象上。
http://dev.w3.org/2006/webapi/WebIDL/#es-attributeshttp://dev.w3.org/2006/webapi/WebIDL/#ecmascript-binding
https://stackoverflow.com/questions/18478913
复制相似问题