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

> Thomas 'PointedEars' Lahn wrote:
>> It saves one needless evaluation step
>
> [...]
> In concrete case which discussed here, you are absolutely right.

But you needed to post something anyway.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
From: Austin Matzko on
On Dec 12, 3:18 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
> How did you arrive at the URL you posted? The FAQ itself links to:http://jibbering.com/faq/#detectBrowser

I looked in the HTML for the nearest relevant-seeming id attribute.
From: Asen Bozhilov on
'PointedEars' Lahn <PointedE...(a)web.de> wrote:
> Asen Bozhilov wrote:

> But you needed to post something anyway.

if (!e)
{
e = window.event;
}

It is enough?

However, in different case you can be incorrect.

| 11.11 Binary Logical Operators
| The production
| LogicalORExpression : LogicalORExpression || LogicalANDExpression
| is evaluated as follows:
| 1. Evaluate LogicalORExpression.
| 2. Call GetValue(Result(1)).
| 3. Call ToBoolean(Result(2)).
| 4. If Result(3) is true, return Result(2).
| 5. Evaluate LogicalANDExpression.
| 6. Call GetValue(Result(5)).
| 7. Return Result(6).


| 12.5 The if Statement
| The production
| IfStatement : if ( Expression ) Statement else Statement
| is evaluated as follows:
| 1. Evaluate Expression.
| 2. Call GetValue(Result(1)).
| 3. Call ToBoolean(Result(2)).
| 4. If Result(3) is false, go to step 7.
| 5. Evaluate the first Statement.
| 6. Return Result(5).
| 7. Evaluate the second Statement.
8. Return Result(7).

Again, i don't see any differences between my two examples in previous
post. Because of that i don't think the part in FAQ is bug.

Regards.
From: Asen Bozhilov on
Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote:
> Asen Bozhilov wrote:
> > Thomas 'PointedEars' Lahn wrote:
> >> It saves one needless evaluation step
>
> > [...]
> > In concrete case which discussed here, you are absolutely right.
>
> But you needed to post something anyway.

Actually you are absolutely right. The part in FAQ is the same as like
that been discussed here. And again have one evaluation step much
more.

e = e || window.event;

In any case will be:

1. Evaluate LeftHandSideExpression.
2. Evaluate AssignmentExpression.
3. GetValue(e).
4. ToBoolean(3).
5. If results 4 is true. Return 3.
6. PutValue(1, 5);





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

[Fixed quotation]
> Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote:
>> Asen Bozhilov wrote:
>
>> But you needed to post something anyway.
>
> if (!e)
> {
> e = window.event;
> }
>
> It is enough?

Probably not, and I pointed that out, too.

> However, in different case you can be incorrect.

I am correct in this case and other cases that belong to the same problem
class.

> | 11.11 Binary Logical Operators
> [...]

You better don't quote the Specification unless you are sure what you are
talking about.

> Again, i don't see any differences between my two examples in previous
> post.

Because your example targets another problem class, if any.

> Because of that i don't think the part in FAQ is bug.

"Bug" was short for "suboptimal example". Quite obviously, there is no
assignment necessary when `e' type-converts to true (indeed, since `e'
refers to a host object, it is error-prone to use it in a type-converting
test). The cost thus spared may be negligible with one call, but you need
to consider how many times an event listener is likely to be called. That
is one point.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee