This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Basically an attribute that returns whether the Text node consists solely of space characters. (This is a slightly changed Text.isElementContentWhitespace (from its originaly definition anyway) with a better name.)
Use case being? :-)
I don't think it is worth polluting the API with something that seems not very common and which is quite easily done today. /^\s*$/.test(textNode.data) or textNode.data.trim() === '' If one really wants it than the following would also work: Object.defineProperty(Text.prototype, 'isWhitespace', { get: function() { return /^\s*$/.test(this.data); }, configurable: true, enumerable: true });
Except that at least in Gecko we could write a significantly faster implementation than can be written in javascript. The reason is that we cache information about if a node is white-space only in order to speed up CSS rendering. I would have guessed that other engines does this too. So if people actually write code like in your examples, then I think we should provide a faster built-in implementation. The question is if people do write code like that. So far it appears that isn't the case so I'm happy to WONTFIX this bug until someone comes up with use cases.
Last I checked CSS whitespace is different from HTML whitespace and both are totally different from JavaScript whitespace.
WONTFIX per comment 3.