Fix xml_child to include leaf types (attributes, PIs, etc.) in its result (313799, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2005-10-27 21:48:20 +00:00
parent c924848adc
commit 0fb916cac2

View File

@ -5573,8 +5573,10 @@ xml_child(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
JS_ASSERT(!JSVAL_IS_PRIMITIVE(v));
vxml = (JSXML *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(v));
if (JSXML_LENGTH(vxml) != 0 && !Append(cx, list, vxml))
if ((!JSXML_HAS_KIDS(vxml) || vxml->xml_kids.length != 0) &&
!Append(cx, list, vxml)) {
return JS_FALSE;
}
}
return JS_TRUE;
}