Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17439

Re: IE9 is not a friend...

Message-ID <67753241.vmHCXkPt3z@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-12-03 23:20 +0100
Subject Re: IE9 is not a friend...
Newsgroups comp.lang.javascript
References <6de7edc4-756c-40a1-ae6b-98ba94062284@m13g2000vbd.googlegroups.com> <C6mdnSBWLPzeiCDNnZ2dnUVZ_sydnZ2d@westnet.com.au> <k9j69b$gdb$1@speranza.aioe.org>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Cezary Tomczyk wrote:

> Personally I use something extra (except checking length) to be sure if
> field is really empty:
> 
> var isEmpty = (function(){
>     var notEmpty = new RegExp('[^\\t\\n\\r ]');

      var notEmpty = /\S/;

>     return function(str){
>        if(typeof str !=== 'string'){
>           return false;
>        }
>        return !notEmpty.test(str);
>     }

RegExp.prototype.test() converts its argument to String.  Therefore:

      return function (str) {
        return !notEmpty.test(str);
      };
 
> }());

… with which the function isEmpty() likely vanishes in a puff of logic.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 13:04 -0800
  Re: IE9 is not a friend... Andrew Poulos <ap_prog@hotmail.com> - 2012-12-04 08:10 +1100
    Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-03 22:41 +0100
      Re: IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 14:06 -0800
        Re: IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 14:27 -0800
        Re: IE9 is not a friend... Christoph Becker <cmbecker69@gmx.de> - 2012-12-04 15:05 +0100
      Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-03 23:20 +0100
        Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-03 23:41 +0100
          Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-04 15:23 +0100
            Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-04 16:12 +0100
    Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-03 23:15 +0100
  Re: IE9 is not a friend... "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-12-03 23:15 +0200

csiph-web