From: Dr J R Stockton on
In comp.lang.javascript message <4bbbbcf9$0$279$14726298(a)news.sunsite.dk
>, Tue, 6 Apr 2010 23:00:03, FAQ server <javascript(a)dotinternet.be>
posted:

>Implementations are inconsistent with ` \s `. For example,
>some implementations do not match ` \xA0 ` (no-break space),
>among others.

That is an unsafe statement, unless checked for each release of the FAQ.
To fix that, just insert ", at yyyy-mm-dd" giving the date of check.

It seems likely that no browser will STOP matching \xA0, in which case
the only one of the 5 major browsers that fails seems to be MSIE.

Why not just put "For example, MSIE 8 does not match ..." and maybe add
the version of the script engine. Currently I have JScript 5.8.22960.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
From: Garrett Smith on
Dr J R Stockton wrote:
> In comp.lang.javascript message <4bbbbcf9$0$279$14726298(a)news.sunsite.dk
>> , Tue, 6 Apr 2010 23:00:03, FAQ server <javascript(a)dotinternet.be>
> posted:
>
>> Implementations are inconsistent with ` \s `. For example,
>> some implementations do not match ` \xA0 ` (no-break space),
>> among others.
>
> That is an unsafe statement, unless checked for each release of the FAQ.
> To fix that, just insert ", at yyyy-mm-dd" giving the date of check.
>
> It seems likely that no browser will STOP matching \xA0, in which case
> the only one of the 5 major browsers that fails seems to be MSIE.
>
> Why not just put "For example, MSIE 8 does not match ..." and maybe add
> the version of the script engine. Currently I have JScript 5.8.22960.
>
OK. That is more specific; sounds like an improvement. I'll add and
update the FAQ with that.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on
Garrett Smith wrote:
> Dr J R Stockton wrote:
>> In comp.lang.javascript message <4bbbbcf9$0$279$14726298(a)news.sunsite.dk
>>> , Tue, 6 Apr 2010 23:00:03, FAQ server <javascript(a)dotinternet.be>
>> posted:
>>
>>> Implementations are inconsistent with ` \s `. For example,
>>> some implementations do not match ` \xA0 ` (no-break space),
>>> among others.
>>
>> That is an unsafe statement, unless checked for each release of the FAQ.
>> To fix that, just insert ", at yyyy-mm-dd" giving the date of check.
>>
>> It seems likely that no browser will STOP matching \xA0, in which case
>> the only one of the 5 major browsers that fails seems to be MSIE.
>>

That is true of the latest versions of the 5 most popular browsers.

>> Why not just put "For example, MSIE 8 does not match ..." and maybe add
>> the version of the script engine. Currently I have JScript 5.8.22960.
>>
> OK. That is more specific; sounds like an improvement. I'll add and
> update the FAQ with that.

On second thought, mentioning IE8 potentially misleading because it is
incomplete. Safari 2 and Konqueror also do not match no-break space. The
chart in the article from that entry has test results of what is and
what is not matched in various browsers.
http://perfectionkills.com/whitespace-deviations/
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on
Thomas 'PointedEars' Lahn wrote:
> FAQ server wrote:
>
[...]

> return String(this).replace(/^\s+|\s+$/g, "");
>
> should be used instead (ES3F/ES5, 15.5.1), whereas the explicit typecast is
> only necessary anyway if this method should be callable for non-String
> objects.
>
The use of String constructor called as a function can result in Error
when the this value is a host object.

String(new ActiveXObject('Microsoft.XMLHTTP'));// IE Error.

IE throws an Error that, when accessing its `name` property, throws the
error "Bad variable type".
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on
Garrett Smith wrote:
> Thomas 'PointedEars' Lahn wrote:
>> FAQ server wrote:
>>
[...]

> The use of String constructor called as a function can result in Error
> when the this value is a host object.
>

Correction:
....can result in Error when the supplied argument is a host object.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/