We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
简单还原代码如下:
seajs.use('widget', function(Widget){ var t = new Widget(); t.set('parentNode', document.getElementById('show')); t.render(); });
IE8及以下报 对象不支持“hasOwnProperty”属性或方法
原因在这:https://github.com/aralejs/base/blob/master/src/attribute.js#L97
isEqual方法内部会最终调用到isEmptyObject,但是没有做isPlainObject的保护判断,所以报错( IE8及以下的原生dom没有hasOwnProperty )
isEqual
isEmptyObject
isPlainObject
The text was updated successfully, but these errors were encountered:
貌似是在实例化 widget 之后才 set parentNode 的问题, 把 parentNode 作为参数传入 Widget, 不会出现 "hasOwnProperty" 的报错.
Sorry, something went wrong.
set("parentNode", xx) 时, 比较的是 当前 parentNode 的值即 document.body 和 xx 是否相等. document.body.hasOwnProperty 却为 undefined ..
d6414e8
最终原因是:
isEmptyObject() 中 Object.prototype.toString.call(document.body) 在 <=IE8 下也为 "[object Object]" , 所以添加判断条件 o.nodeType || isWindow(o)
之前一直没注意,这段逻辑在实例化的时候不会触发,只有调用 set 的时候才触发,所以使用 parentNode 的时候一直没问题。
No branches or pull requests
简单还原代码如下:
IE8及以下报 对象不支持“hasOwnProperty”属性或方法
原因在这:https://github.com/aralejs/base/blob/master/src/attribute.js#L97
isEqual
方法内部会最终调用到isEmptyObject
,但是没有做isPlainObject
的保护判断,所以报错( IE8及以下的原生dom没有hasOwnProperty )The text was updated successfully, but these errors were encountered: