Hi,

On Apr 21, 3:38 pm, Rüdiger Plantiko <[email protected]>
wrote:
> > 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?

I doubt it (it would be quite a trick as the HTML5 working group
hasn't even stopped accepting new proposals yet), but the second[1] of
my textContent references was from six years ago. Microsoft's brought
out two major revisions since then, and yet...

> If somebody really is annoyed by this drawback, he could write
>
> $('test').textContent || $('test').innerText || ""

See Yuriy's links for why those aren't the same thing. :-)

> 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. Yeah, actually, it's really quick even in the more complex
case, too. I was surprised and pleased by that. :-)

[1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Apr 21, 3:38 pm, Rüdiger Plantiko <[email protected]>
wrote:
> 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 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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