From: John G Harris on
On Sun, 3 Jan 2010 at 10:18:43, in comp.lang.javascript, Dmitry A.
Soshnikov wrote:
>On 3 0
<snip>
>> You could have quoted like this :
>>
>> >> In a Web page, it's generally a terrible idea
>>
>> � <your complaint about 'terrible'>
>>
>
>I know that, thanks.

If you know that then why did you make it look as though David wrote the
word 'terrible' four times ?


>> >>as scripts typically
>> >> have to co-exist with others.
>>
>> � <your agreement about 'co-exist'>
>>
>
>I also know that, thanks.

John
--
John Harris
From: Dmitry A. Soshnikov on
On 4 янв, 23:16, John G Harris <j...(a)nospam.demon.co.uk> wrote:
> On Sun, 3 Jan 2010 at 10:18:43, in comp.lang.javascript, Dmitry A.
>
> Soshnikov wrote:
> >On 3 0
>   <snip>
> >> You could have quoted like this :
>
> >> >> In a Web page, it's generally a terrible idea
>
> >>   <your complaint about 'terrible'>
>
> >I know that, thanks.
>
> If you know that then why did you make it look as though David wrote the
> word 'terrible' four times ?
>

I've already answered to you. Should I repeat twice? Please ask if
something still unclear, I will.

/ds
From: Jorge on
On Jan 4, 9:13 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
> Eric Bednarz wrote:
>
> > It works in Safari 2.04; I would expect that people who are stuck with
> > OS X 10.4 would still run system updates.
>
> Ah but 10.4 can get Safari 3 and 4. 10.3 users are a different matter.

10.3 users can install FF2 or iCab 3 or iCab 4 or Opera 8 or 9 or 10,
or ...

> Now for 10.3, you'd need to support Safari 1. I do know any way to test
> Safari 1 on 10.4.

Safari 1 is as obsolete as IE5. There's no need to support that (see
above the plenty of alternative options that 10.3 users have)

> Apple bundles the Browser with the operating system, but somehow does
> not suffer the legal troubles that Microsoft has experienced in doing
> the same.

Only that to uninstall Safari all you need to do is to trash its icon,
and doing that won't "damage the operating system" -as used to be the
case when uninstalling IE- (http://en.wikipedia.org/wiki/
United_States_v._Microsoft and http://en.wikipedia.org/wiki/Removal_of_Internet_Explorer).
And the OSX APIs that Safari uses are public so that other browser
makers can use them too (unlike the IE/Windows combo), and that
Safari's source code is open, public and free. And that Apple OSs up
to OSX (year 2001), came with both IE and NetScape Navigator installed
by default.

> Apple does a lot worse things and gets away with those, too. Apple a good example what is wrong with business in America.

People's idiocy in general (and some people's idiocy in particular) is
much worse a problem currently than Apple's business practices. BTW,
here's some -hot- dirty play being made to Apple, see see:
http://stadium.weblogsinc.com/engadget/files/apple-nokia-answer.pdf
--
Jorge.
From: Jorge on
On Jan 4, 9:13 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
> Eric Bednarz wrote:
>
> > It works in Safari 2.04; I would expect that people who are stuck with
> > OS X 10.4 would still run system updates.
>
> Ah but 10.4 can get Safari 3 and 4. 10.3 users are a different matter.

10.3 users can install FF2 or iCab 3 or iCab 4 or Opera 8 or 9 or 10,
or ...

> Now for 10.3, you'd need to support Safari 1. I do know any way to test
> Safari 1 on 10.4.

Safari 1 is as obsolete as IE5. There's no need to support that (see
above the plenty of alternative options that 10.3 users have)

> Apple bundles the Browser with the operating system, but somehow does
> not suffer the legal troubles that Microsoft has experienced in doing
> the same.

Only that to uninstall Safari all you need to do is to trash its icon,
and doing that won't "damage the operating system" -as used to be the
case when uninstalling IE- (http://en.wikipedia.org/wiki/
United_States_v._Microsoft and http://en.wikipedia.org/wiki/Removal_of_Internet_Explorer).
And the OSX APIs that Safari uses are public so that other browser
makers can use them too (unlike the IE/Windows combo), and that
Safari's source code is open, public and free. And that Apple's OSs up
to OSX (year 2001), came with both IE and NetScape Navigator installed
by default.

> Apple does a lot worse things and gets away with those, too. Apple a good example what is wrong with business in America.

People's idiocy in general (and some people's idiocy in particular) is
much worse a problem currently than Apple's business practices. BTW,
here's some -hot- dirty play being made to Apple, see see:
http://stadium.weblogsinc.com/engadget/files/apple-nokia-answer.pdf
--
Jorge.
From: Matt Kruse on
On Jan 2, 11:40 pm, Ryan Chan <ryanchan...(a)gmail.com> wrote:
> Have read Douglas Crockfore's JavaScript The Good Parts, it recommend
> Augmenting Types, e.g.
> String.method('trim', function() {
>     return this.replace(/^\s+|\s+$/g, '');
> });

There have been a number of replies. I'll just post some pros/cons to
adding the methods _only if they don't already exist_:

PRO:
1) Consistent API defined by specs, not some additional list of
functions developers need to learn
2) Native method used if it already exists, so you take advantage of
browser optimizations
3) As browsers are upgraded and fast native methods are added, they
will automatically be used without changing your code

CON:
1) Other code on your page may break due to naive "feature tests" and
object inferences that you have now corrected, or dumb for loops that
iterate over your added properties.
2) User-defined functionality may not exactly match the browser's
native functionality.
3) Browsers without the method may be upgraded to add the method, but
add bugs or quirks and make it _worse_ than the user-defined function
and/or break functionality.
4) Other code on your page may choose to do the same thing, but use
different logic than you. You won't be sure if your methods have been
"stepped on" and replaced.
5) You're likely delivering a lot of code to define methods in
browsers that may not need any of it because native methods already
exist.

Of course, if you over-write methods even if they exist you may get
consistent user-defined behavior across all browsers, but you lose
native methods and open yourself up to introducing bugs, so that isn't
a good idea.

CONCLUSION:
I think that implementing a few methods that are in the standards and
add convenience but may not exist in older browsers is not a bad idea.
However, you shouldn't have a single file that you include everywhere
that implements every known method that may be lacking, because that's
a waste of bytes and processing for browsers that don't need it. Just
implement the methods you'll be using on the page where you want them,
if possible.

Matt Kruse