문제

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
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top