--- In svg-developers@yahoogroups.com, Jonathan Watt <[EMAIL PROTECTED]> wrote:
> Why not loose the comments and use the self commenting constants? > > if (childNode.nodeType == childNode.ELEMENT_NODE) { > ... > } > else if (childNode.nodeType == childNode.TEXT_NODE) { > ... > } The W3C DOM would suggest to use e.g. childNode.nodeType == Node.ELEMENT_NODE but while Mozilla exposes Node and Node.ELEMENT_NODE I don't think that Adobe SVG viewer (3.x) for instance does that. Nor does IE for instance when you script HTML. The latter is of course not relevant to SVG scripting but for me it is easier to write DOM script in one way that I think works in many different implementations instead of trying to adapt to particular implementation. That is why I usually avoid using e.g. Node.ELEMENT_NODE so far and have the number it represents in the code. What you suggest, childNode.ELEMENT_NODE, is not supported in Adobe SVG viewer either. Nor in other DOM implementations I know, beside Mozilla's DOM implementation. But admittedly my script code in the post was not very portable when it comes to DOM implementations in SVG viewers as it uses childNodes[index] which the W3C DOM requires to be equivalent to childNodes.item(index) for ECMAScript bindings but which unfortunately Adobe SVG viewer 3.x does not implement. So that stuff needs to be var childNodes = someElement.childNodes; for (var i = 0; i < childNodes.length; i++) { var childNode = childNodes.item(i); to be more portable code for an SVG group. ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/