Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
195
rated 0 times [  199] [ 4]  / answers: 1 / hits: 52973  / 14 Years ago, mon, april 26, 2010, 12:00:00

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?


More From » null

 Answers
9

You may want to do the following:



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

[#96972] Thursday, April 22, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amari

Total Points: 736
Total Questions: 111
Total Answers: 90

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;