2010-04-26 131 views

回答

8

您可能需要执行以下操作:

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

这个测试的下半年扔我一个错误......如果((documentFragment.firstChild == NULL)&&(documentFragment.firstChild.hasOwnProperty ('tagName')) – Matrym 2010-04-26 08:11:04

+0

@Matrym:你可以试着做alert(typeof documentFragment);'。你得到'object'还是'undefined'? – 2010-04-26 08:12:39

+0

未捕获的SyntaxError:意外的令牌{ – Matrym 2010-04-26 08:12:46