xml - javascript + e4x: how to test if an element is empty? -
xml - javascript + e4x: how to test if an element is empty? -
is there way test whether xml element empty using e4x?
e.g. if have element <foo />
, want homecoming true, if have element has attributes, kid elements, or text, want homecoming false.
i slogged through ecma-357 v2 spec on e4x; methods xml nodes listed in section 13.4.4, , there no useful isxxx()
or hasxxx()
methods test; simplest way seems following:
function isemptynode(node){ homecoming node.children().length() == 0 && node.attributes().length() == 0; }
javascript xml e4x
Comments
Post a Comment