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?
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?
Share Improve this question asked Apr 26, 2010 at 7:54 MatrymMatrym 17.1k35 gold badges99 silver badges141 bronze badges1 Answer
Reset to default 8You may want to do the following:
if ((documentFragment !== null) && documentFragment.hasOwnProperty('xxx')) {
// handle property xxx of documentFragment as required
}