I ran into this recently - I thought that in the past it had been
recursive.

But, the code I see looks like:

  cleanWhitespace: function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  },

1. I don't see any reason for the element = $(element) line, other
than possibly for the return value;
    it isn't used within the function
2. adding the marked line seems to make it work the way I want it to.

  cleanWhitespace: function(element) {
    //element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
        if (node.nodeType == 1) Element.cleanWhitespace(node);  //
Added -----------------!
      node = nextNode;
    }
    return element;
  },

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to