<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14443</bug_id>
          
          <creation_ts>2011-10-12 23:48:27 +0000</creation_ts>
          <short_desc>Introduce Text.isWhiteSpace?</short_desc>
          <delta_ts>2011-12-20 20:06:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne">annevk</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>erik.arvidsson</cc>
    
    <cc>jonas</cc>
    
    <cc>mathias</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>shadow2531</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>58167</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-10-12 23:48:27 +0000</bug_when>
    <thetext>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.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58177</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-13 06:06:04 +0000</bug_when>
    <thetext>Use case being? :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58722</commentid>
    <comment_count>2</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2011-10-23 20:31:57 +0000</bug_when>
    <thetext>I don&apos;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() === &apos;&apos;

If one really wants it than the following would also work:

Object.defineProperty(Text.prototype, &apos;isWhitespace&apos;, {
  get: function() {
    return /^\s*$/.test(this.data);
  },
  configurable: true,
  enumerable: true
});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58724</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-10-23 21:26:50 +0000</bug_when>
    <thetext>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&apos;t the case so I&apos;m happy to WONTFIX this bug until someone comes up with use cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58731</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-10-24 09:11:53 +0000</bug_when>
    <thetext>Last I checked CSS whitespace is different from HTML whitespace and both are totally different from JavaScript whitespace.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61838</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-12-20 20:06:11 +0000</bug_when>
    <thetext>WONTFIX per comment 3.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>