Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] NodeList returned includes "\n" as nodes

Expand Messages
  • Jeff Craig
    ... Not really. The Standard says that any whitespace between nodes is a own Text Node, and Firefox implements it this way. It s annoying, but it is the
    Message 1 of 3 , Sep 1, 2008
    • 0 Attachment
      On Sat, 2008-08-30 at 13:07 -0400, Timothy Stone wrote:
      > When I query the document for various childNodes, I'm getting the
      > NodeList, plus "\n" as nodes, doubling the returned childNodes of a
      > particular element.
      >
      > The XHR is running on Firefox 3/Mac. It might be an implementation
      > bug.
      >
      > Any tips on this? Pointers already posted? My search of the list was
      > not as effective as I might have liked it. Right now I'm just looping
      > through the NodeList and testing its nodeType against "3" and
      > dropping
      > it. Any better way?

      Not really. The Standard says that any whitespace between nodes is a
      own Text Node, and Firefox implements it this way. It's annoying, but
      it is the standard, and you do have to develop against it. Because of
      the way the standard is developed, it does seem like you're expected to
      do a lot more of "getElementsByTagName" instead of iterating over
      childNodes, but if iterating childNodes is what makes sense in your
      problem space, what you're doing is reasonable.

      Jeff Craig
    Your message has been successfully submitted and would be delivered to recipients shortly.