开发者

"Cannot read property 'xxx' of null"

开发者 https://www.devze.com 2022-12-27 23:13 出处:网络
I\'ve got a document fragment with children that开发者_如何学运维 I want to loop over (when possible). This is causing an error \"Cannot read property \'xxx\' of null\".

I've got a document fragment with children that开发者_如何学运维 I want to loop over (when possible). This is causing an error "Cannot read property 'xxx' of null".

How do I test if this will be the case?


You may want to do the following:

if ((documentFragment !== null) && documentFragment.hasOwnProperty('xxx')) {
    // handle property xxx of documentFragment as required
}
0

精彩评论

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