From: Asen Bozhilov on
Garrett Smith wrote:

> Right, I see that now. Weird! It seems that with Host object in IE, the
> + operator behaves differently.

Yes, but addition operator have different behavior not only with host
objects. See below with native object:

var o = {toString : null, valueOf : null};
try {
window.alert(String(o));
}catch(e) {
window.alert(e instanceof TypeError); //[[DefaultValue]] throw
TypeError
}

window.alert('' + o); //empty primitive string value
window.alert(o + ''); //[object]

They have much more complex algorithm, from presented in ECMA262-3
documentation. And they, definitely doesn't follow specification in
that point.

From: Asen Bozhilov on
Thomas 'PointedEars' Lahn wrote:

> Yet another bug triggered by unwise programming.

No. That is yet another bug from Microsoft ECMA-262 implementation,
called with name JScript. In normal case:

new ActiveXObject('Microsoft.XMLHTTP') + ''; //expected TypeError

And nobody suggest to do it that.

> No.  There is also no need of or advantage in relying on implicit
> typecasting.

| ECMA 5 15.5.4.20
| NOTE The trim function is intentionally generic;
| it does not require that its this value be a
| String object.
| Therefore, it can be transferred
| to other kinds of objects for use as a method.

From: Asen Bozhilov on
Thomas 'PointedEars' Lahn wrote:

> Neither writing nor reading appear to be the forté of the current FAQ
> maintainer -- goodnight, cljs.

So what? I told you before. If you have any problem in real life, go
outside and take a fresh air, before start blaming everyone in
c.l.js.



From: Dr J R Stockton on
In comp.lang.javascript message <hhro9k$mn9$1(a)news.eternal-
september.org>, Sun, 3 Jan 2010 19:45:50, Garrett Smith
<dhtmlkitchen(a)gmail.com> posted:
>>
>> The Contributors section in the Notes is years out of date.
>Certainly is. Anyone want to propose a draft?

I shall be reasonably content with anything that does not include my
name.

--
(c) John Stockton, Surrey, 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
JR wrote:
> On Jan 4, 5:14 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>> Asen Bozhilov wrote:
>>> Garrett Smith wrote:
>>>> How do I trim whitespace?
>>>> Change code to coerce the thisArg to String, as per ES5

[...]

>> Look OK?
>
> It looks completely odd to me. If you test for String.prototype.trim,
> then there's no sense in coercing the argument to string, as in (this
> + '') or ('' + this), because the trim method should only be used with
> strings. The trim() method proposed in the FAQ looks like a mutant,
> and I doubt that the FF native code does such a coercion.
>

You should check those doubts against the specification.

Asen was correct in bringing this up and in the workaround for the
JScript bug he mentioned.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/