On Jan 5, 11:23 am, Matt Foster <mattfoste...@gmail.com> wrote:
> Hey Everyone,
>       I'm working on a project that swaps out text nodes.  I need to
> save a reference to the new text node with the existing node.  In FF I
> am able to set custom properties no problem, IE however throws an
> error of "Object does not support this property or method".  I was
> thinking I could use a hash object and the text nodes node value
> property as the key, and the new node as the value but this seems
> incredibly sloppy, especially as its a hack for IE only.  Anyone know
> how I can get around it this error?

Damn, just killed an hour of work time "to solve the puzzle" : )

Hash sounds good, but would fail when given nodes with non-unique text
values (since JS doesn't natively support non-string object keys). It
seems like IE's textNode's throw error for any property assignment
except when property is named `nodeValue` or `data`. It is,
unfortunately, impossible to use those properties since their change
is immediately reflected in the document (i.e. changing node's text).

I would suggest to leave text nodes along for maximum compatibility/
reliability, but if you must here's a workaround:

var t = document.createTextNode('boo');
t.nodeValue.toString.toString = function() {


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 
For more options, visit this group at 

Reply via email to