Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!feed.xsnews.nl!border-2.ams.xsnews.nl!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <67753241.vmHCXkPt3z@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Mon, 03 Dec 2012 23:20:59 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 34 NNTP-Posting-Date: 03 Dec 2012 23:20:59 CET NNTP-Posting-Host: b5e16711.newsspool1.arcor-online.net X-Trace: DXC=NnEN;iXE03oIkjb;<8iR=aic==]BZ:afn4Fo<]lROoRankgeX?EC@@`IRTKiQcV`1dDZm8W4\YJNlR=i2=[N6Y6jjNe=bP 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