Hi Eric and TJ,

thanks for your further research in this matter!



> Surprisingly, IE8 still doesn't support it, but even if it did,
> frankly it doesn't do what _I'd_ want.

Does IE8 claim to be HTML5 compliant?

> $('test').textContent || $('test').innerText
> The only drawback I can think of is that sometime you may get an
> undefined instead of an empty string (which would be equivalent to
> false).

If somebody really is annoyed by this drawback, he could write

$('test').textContent || $('test').innerText || ""

This solution is fine if you have a handful evaluations of text
contents, as it will usually be the case. But anyway, a browser-
independent abstraction would be nice so that this construct is only
at one place in the code. This why I posted the question.

As you point out in your next posting, an optimization would be to
check the existence for the implementation of the property
"HTMLElement.textContent" only once instead of with each text content
evaluation.

TJ, thanks for the solution propagating the DOM tree with the nice
recursive textValueCollector() function. In the 90% case, only one
descent will be necessary. This makes your solution even better: It
works with satisfactory performance for complex text contents, and it
returns quickly in the 90% case.

Thanks and regards,
Rüdiger




-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to