On 1/30/07, Karsten Patzwaldt <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote:
>
> Well, no. But that helped writing a workaround:
>
> function nodeMap(f, node)
> {
>     nodeWalk(node,
>              function(node)
>              {
>                  var ret = node.childNodes;
>                  var res = f(node);
>
>                  if (res)
>                      {
>                          swapDOM(node, res);
>                      }
>
>                  return ret;
>              });
>
>     return node;
> }
>
> I'd still prefer this code to be non-destructive, because that's the
> only assignment I'm using right now, but I guess that's the best I can
> get without writing a new traversal routine.

Well if you wanted it to be non-destructive you could call nodeMap(f,
node.cloneNode(true)).

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to