Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Dave Methvin
>> Object wrappers are a minefield because they sometimes don't behave 
>> the same as their primitive type. For example, eval() won't work if 
>> called with a "new String" argument, and "new Boolean(false)" 
>> evaluates to TRUE in a conditional context because it's an object.
>
> new Boolean(false) becomes false, but new Boolean('false') becomes true. 
> Or did I get that wrong?
> 
> http://www.jibbering.com/faq/faq_notes/type_convert.html#tcBool

It's not a type conversion, it's the object wrapping that causes havoc.
Boolean(false) returns its argument converted to a primitive boolean type;
new Boolean(false) converts its argument and wraps it in a Boolean object.

Copy/paste this into your favorite browser address bar:

javascript:b=Boolean(false); if(b) alert("true=="+b);else
alert("false=="+b);

Completely expected output, right? Now, add "new" to create a Boolean
object:

javascript:b=new Boolean(false); if(b) alert("true=="+b);else
alert("false=="+b);

Any object in a conditional context is considered to be true, even a Boolean
_object_ with a false value. However, when it comes time to print the value,
the .toString() method pulls out the actual value.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Klaus Hartl
Dave Methvin schrieb:
> Object wrappers are a minefield because they sometimes don't behave the same
> as their primitive type. For example, eval() won't work if called with a
> "new String" argument, and "new Boolean(false)" evaluates to TRUE in a
> conditional context because it's an object.

new Boolean(false) becomes false, but new Boolean('false') becomes true. 
Or did I get that wrong?

http://www.jibbering.com/faq/faq_notes/type_convert.html#tcBool



-- Klaus


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Dave Methvin

> http://dev.opera.com/articles/view/48/
> 
> I didn't know that this:
> var s = new String('0123456789');
> for( var i = 0; i < s.length; i++ ) {
>   s.charAt(i);
> }
> 
> [is faster than?--dm] this:
> var s = '0123456789';
> for( var i = 0; i < s.length; i++ ) {
>   s.charAt(i);
> }
> because of the implicit object conversion involved. 

Optimizations based on Opera may go the wrong way for a majority of users.
For example, here are some hard millisecond numbers from a test of that
example:

Object  string
Opera 9: 344 406
FF 1.5: 18592703
IE6: 640 453

So, it's blazingly fast either way in Opera, faster to use a string in IE,
and a choice between slow and horribly slow in Firefox. Perhaps a difference
in memory usage would justify it if the string was extremely long?

Object wrappers are a minefield because they sometimes don't behave the same
as their primitive type. For example, eval() won't work if called with a
"new String" argument, and "new Boolean(false)" evaluates to TRUE in a
conditional context because it's an object.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Jörn Zaefferer
> And by the way: the site is not centered on developing for/with Opera.

True. I didn't want to hijack your thread for an Opera discussion. The 
"Efficient Javascript" article is really a good read: 
http://dev.opera.com/articles/view/48/

I didn't know that this:
var s = new String('0123456789');
for( var i = 0; i < s.length; i++ ) {
  s.charAt(i);
}

then this:
var s = '0123456789';
for( var i = 0; i < s.length; i++ ) {
  s.charAt(i);
}

because of the implicit object conversion involved. There is a lot of stuff 
that could be used to improve the jQuery core performance.

--
Jörn Zaefferer

http://bassistance.de
-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Klaus Hartl
Jörn Zaefferer schrieb:
>> There's not nearly enough publicity about Opera for my liking. What, with
>> it
>> being a more powerful browser than Firefox and all...
> 
> It's build-in adblocker can't compete with FF's extension adblocker. Sad, but 
> the main reason I'm not using Opera most of the time.

Really? I'm using Firefox because for developing I think it has the 
better plugins (tools). But Opera is catching up there, and honestly, 
maybe I just don't know the right tools for Opera...

For private use I'm using Flock because I love the del.icio.us integration.


And by the way: the site is not centered on developing for/with Opera.



-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Dan Atkinson

Ahh... But is the built in adblocker in Opera better than Firefox without
one?!

I mean, how many ads does Firefox block without the adblocker installed...
And how many does Opera block by default?!


Jörn Zaefferer wrote:
> 
>> There's not nearly enough publicity about Opera for my liking. What, with
>> it
>> being a more powerful browser than Firefox and all...
> 
> It's build-in adblocker can't compete with FF's extension adblocker. Sad,
> but the main reason I'm not using Opera most of the time.
> 
> --
> Jörn Zaefferer
> 
> http://bassistance.de
> -- 
> GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
> NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/New-Dev-center-by-Opera-tf2586811.html#a7215110
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Jörn Zaefferer
> There's not nearly enough publicity about Opera for my liking. What, with
> it
> being a more powerful browser than Firefox and all...

It's build-in adblocker can't compete with FF's extension adblocker. Sad, but 
the main reason I'm not using Opera most of the time.

--
Jörn Zaefferer

http://bassistance.de
-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Dev center by Opera

2006-11-07 Thread Dan Atkinson

Cheers!

There's not nearly enough publicity about Opera for my liking. What, with it
being a more powerful browser than Firefox and all...


Klaus Hartl-3 wrote:
> 
> Hi all,
> 
> this is not exactly jQuery related, but there's a new Dev center by 
> Opera, and as one could expect from them there are already some nice 
> articles online.
> http://dev.opera.com/
> 
> 
> Worth reading for example: Efficient JavaScript:
> http://dev.opera.com/articles/view/48/
> 
> 
> -- Klaus
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/New-Dev-center-by-Opera-tf2586811.html#a7214677
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] New Dev center by Opera

2006-11-06 Thread Klaus Hartl
Hi all,

this is not exactly jQuery related, but there's a new Dev center by 
Opera, and as one could expect from them there are already some nice 
articles online.
http://dev.opera.com/


Worth reading for example: Efficient JavaScript:
http://dev.opera.com/articles/view/48/


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/