A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Text node (pseudo-)selector

stuartpb
2015-07-27

This is something people want, and something that would be useful for polyfilling other properties and behaviors.

MT
2015-08-10

By the way, having a selector for text nodes would also allow to select them with querySelectorAll() in JS. Currently, there is no simple cross-browser native way to select nodes of arbitrary type (like getElementsByTagName(), but for nodes of any type), text nodes in particular.

Though a dedicated JS method like getNodesByType() would probably still be more reasonable for that purpose, but selector way would probably at least be better than nothing.

stuartpb
2015-08-10

This post by John Resig I feel lays out a solid strategy for prollyfilling this method: http://ejohn.org/blog/unimpressed-by-nodeiterator/