Domain: bclary.com
Stories and comments across the archive that link to bclary.com.
Comments · 15
-
Re:JavaScript
> could you please tell me where the language is fundamentally broken ?
I do WebGL development and for the most part enjoy the quick turn around time. (Thank god for "ShaderToy" www.iquilezles.org/apps/shadertoy/ )
While Javascript is a breath of fresh air from hard-core C/C++ work, Javascript is a piss poor programming language
...0. typeof() is broken w.r.t. to arrays
var a = [];
console.log( typeof( a ) ); // does NOT return array, but object?!1. Variables by default can be used anywhere without being declared. Have a typo? You will most likely never catch it unless
a) using an IDE
b) using the hack
"use strict";
by placing that literal string hack near the top of your .js file2. Stupid semicolon statement insertion.
3. ALL numbers are doubles. There are no native signed or unsigned or ints, nor floats. Doubles SUCK for performance especially when all you want & need is integer math.
4. No proper line concatenation
i.e. var a = "....\
foo\
bar\
"; //Technically one shouldn't be able to escape the new line character, but it works
... for now.
http://bclary.com/2004/11/07/#a-7.8.4
"A 'LineTerminator' character cannot appear in a string literal, even if preceded by a backslash \. The correct way to cause a line t
terminator character to be part of the string value of a string literal is to use an escape sequence such as \n or \u000A."Haven't they learnt ANYTHING from C, Python, etc. ??
5. You have to very careful when doing (string) concatenation else you may not get what you expect.
6. No native way to include
.js files inside another .js file and have a callback unless you write it yourself. i.e.
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onload = callback;
head.appendChild( script );7. The return statement is broken w.r.t whitespace. You can't have return on an empty line.
i.e var foo = (function( callback ) {
return // doesn't work!
1;
}8. All the debuggers suck ass. Good luck get it to show anonymous functions properly!
I could go one, but for a more complete list, see
http://oreilly.com/javascript/excerpts/javascript-good-parts/awful-parts.html -
Re:Javascript is a disaster
I really don't think you understand Javascript quite enough to be commenting this strongly on it.
It does have types, to speak of and to use. They are in the spec, they are in the language, they work. http://bclary.com/2004/11/07/#a-
Since when has "+" appended 2 numbers? When they are strings I would imagine, which is exactly what most languages do. You might need to get your head around javascript types to stop this happening.
Javascript has scope -- it's quite well defined.
Object oriented does not mean classes, there are other ways of doing it. In particular, the prototype pattern which is followed by javascript. It can have inheritance because of this pattern also.Javascript has been an ECMA standard for the last 15 years, and cannot be thought of as a one-person hack in any way.
I shake my head.
-
Re:This seems desperate...How to properly sniff for a version of Gecko It still uses script. What happens when, in order to work around user agent deficiencies, the server has to change the HTML before the user agent executes script? How to feature sniff instead of browser sniff This page still recommends browser sniffing if different browsers diverge from the spec in different ways. Case in point: clientX and clientY.
-
Re:This seems desperate...
-
Re:Needs a Concatenation Operator
It "recycles" the + operator (which usually is used for adding numbers) to concatenate strings.
The technical term for that is "overloads".
JavaScript runs on the client side -- meaning no webmaster can ever know for sure what JavaScript engine is in use.
There are some tricks that you can perform to try to work it out. You could also do something server-side by sniffing the user-agent header and comparing it to a list to take an educated guess at the likely level of support.
Of course, given that (according to the linked page) not all browsers respect the language attribute and of course user-agent headers can be faked or missing, you can't rely on it. The usual method to ensure compliance is simply to test against a specified subset of browsers and support only them; that doesn't necessarily mean locking out all other browsers, but you should at least make users aware that they may experience some turbulence... -
Re:Good for Open Source?... they think it's a good idea to make the main navigation menu require IE 5.x or better.
Go to this site and install the Mozilla evangelism sidebar. Set your user agent string to something IE5ish. I'll bet that a recent Mozilla will work just fine. After all, the sign says ``IE5 or better''!
I've done this on several IE-only sites, and had great results.
-
Re:Why I won't switch from IE (yet).
1. Mozilla interface feels "heavy" and slow. The buttons just feel "heavy" to me. IE6 feels light and it looks like a Windows program. Plus, it loads more quickly.
No Argument here. Part of the reason why Phoenix exists...
2. Google toolbar. Yeah, I've used the mozdev one... and it's just not as impressive. I cannot do the following with the Mozdev bar:
I agree a real Google toolbar would be nice. Almost all my searches are mapped onto Mozilla keywords though, which works pretty well. Along w/ the search sidebar and background tabs, I think overall, Mozilla still wins on searching.
4.View Partial Source. Once again, mostly a web developer tool, but an invaluable one at that. I highlight any part of the page, click "View Partial Source", and I'm staring at the source code that created that part of the page.
Mozilla does this. At least mine does, it may have been an extension I installed a long time ago. As a web Developer, here's my list of favorite Mozilla features (I will never do web development in a browser that doesn't have an equivalent to these):
- DOM Inspector" - omg, this is the best thing ever
- Venkman - built-in JavaScript Debugger / Profiler
- Mozilla Source Generator - view the generated source from the DOM
- Gecko - the most complete standards support of any existing browser. I can trust Mozilla's CSS output instead of assuming it's wrong.
Overall, the tabs, sidebars, tools, and other interfaces make Mozilla by and large my favorite development browser. Here are some of my big nits:
- HTTP logging / browser - wish I could see this stuff without having to go to a separte network sniffer/logger
- Better Info - would like to see all HTTP headers, cookies, source, dom from one centralized interface. there is a 'web developer' version on Mozilla being worked on... that might be way cool
- Crash Recovery for Tabs - Total Recall gets broken, Multizilla only records one window's tabs
- Form Ranging - it's still broken, part of the larger problem...
- ...that Content Editing is weak sauce. Whatever browser has significantly improved form/editing capabilities will definitely have my endearment - stuff like inline editing, or for forms, basic stuff like better local form input capture/caching, integration of editing commands, etc.
-
Big Sites Have Big Problems - But There Is HopeFirst off I want to dispel the myth that only small fry peon sites have standards compliance problems. Bugzilla currently has 1920 Tech Evangelism bugs open. These bugs all deal with websites that have poor coding resulting in problems rendering properly in Mozilla. These are sites like:
- National Australia Bank Click "Register Now" and you get a "Your Browser Version is not supported"
- CN Rail North America's Railroad (Excluding non-NS6 users).
- Bank Of America Try to apply for a gold card and the form gets screwed up.
- Benjamin Moore Sorry our page is designed for IE only, buy your paint elsewhere.
- Novartis Screwed up rendering.
- Connectsite Exchange, Collaborate, Connect! Unless of course your using a non IE browser, then go away.
This isn't counting the 1720 Tech Evangelism bugs that have already been resolved. Sites like salomonsmithbarney.com, yahoo.com, cbs.com, citrix.com and many many more have all resolved improper coding issues that screwed up non IE rendering. But the positive news is that in 1720 cases web administrators have changed their websites to make them unbroken.
Here's an example. One of the most highly reported bugs (bug 114812) that has since been fixed was with hotmail. Due to faulty javascript implementation if you would select the "ALL MESSAGES" box in your inbox only one message would actually be selected, so to delete the mountains of spam that accumulate daily you had to click the box beside _each_individual_message_. Clicking 200 checkboxes after not checking your mailbox for a few days does not a fun time make. Anyway after about 6 months of pestering microsoft finally fixed it. The moral: If complaining can make Microsoft make its pages standards compliant well the sky's the limit.
Anyway if you want to do something to help check out Mozilla Evangelism The site is chock full of advice about how to report and deal with non-compliant websites. You can even use the Letter Writing Tool to write and send a nifty letter to website administrators who haven't yet seen the light. Obviously the site is geared to getting things to work properly in Mozilla, but the fact is, things tend to work in Mozilla if they are standards compliant.
-
Big Sites Have Big Problems - But There Is HopeFirst off I want to dispel the myth that only small fry peon sites have standards compliance problems. Bugzilla currently has 1920 Tech Evangelism bugs open. These bugs all deal with websites that have poor coding resulting in problems rendering properly in Mozilla. These are sites like:
- National Australia Bank Click "Register Now" and you get a "Your Browser Version is not supported"
- CN Rail North America's Railroad (Excluding non-NS6 users).
- Bank Of America Try to apply for a gold card and the form gets screwed up.
- Benjamin Moore Sorry our page is designed for IE only, buy your paint elsewhere.
- Novartis Screwed up rendering.
- Connectsite Exchange, Collaborate, Connect! Unless of course your using a non IE browser, then go away.
This isn't counting the 1720 Tech Evangelism bugs that have already been resolved. Sites like salomonsmithbarney.com, yahoo.com, cbs.com, citrix.com and many many more have all resolved improper coding issues that screwed up non IE rendering. But the positive news is that in 1720 cases web administrators have changed their websites to make them unbroken.
Here's an example. One of the most highly reported bugs (bug 114812) that has since been fixed was with hotmail. Due to faulty javascript implementation if you would select the "ALL MESSAGES" box in your inbox only one message would actually be selected, so to delete the mountains of spam that accumulate daily you had to click the box beside _each_individual_message_. Clicking 200 checkboxes after not checking your mailbox for a few days does not a fun time make. Anyway after about 6 months of pestering microsoft finally fixed it. The moral: If complaining can make Microsoft make its pages standards compliant well the sky's the limit.
Anyway if you want to do something to help check out Mozilla Evangelism The site is chock full of advice about how to report and deal with non-compliant websites. You can even use the Letter Writing Tool to write and send a nifty letter to website administrators who haven't yet seen the light. Obviously the site is geared to getting things to work properly in Mozilla, but the fact is, things tend to work in Mozilla if they are standards compliant.
-
Mozilla Tech Evangelism
Make a repository of sites which break on non-IE browsers
As illsorted pointed out, you should look into Mozilla Tech Evangelism. If you find a site that discriminates against Mozilla or otherwise doesn't work, search Bugzilla for it, and if it's not already listed, add it using Bugzilla Helper.
(I had to use a workaround to link to Bugzilla because Bugzilla refuses links from OSDN referers. It's not the goat.)
Oh, and how many of you
... are posting via IE on windows anyway?I use a Mozilla nightly build on my home winbox, but when I'm on a public terminal, I don't have rights to install Mozilla, so I just use whatever's installed (IE 5.x, or NS 4.x with CSS turned off).
-
Mozilla Evangelism
Check out the Mozilla Evangelism site. They keep up a list of sites that are not standards-compliant (and therefore don't render well in Moz), including a list of specific bugs and their status for each site.
-
Mozilla Evangelism
Check out the Mozilla Evangelism site. They keep up a list of sites that are not standards-compliant (and therefore don't render well in Moz), including a list of specific bugs and their status for each site.
-
Re:ASP support?
Knowing the mental qualities of most page-restrictors, this fools their detection scripts quite nicely. This can blow up in your face, however, if the malicious web designer chooses to intentionally exclude Opera, by denying all browsers that contain 'opera' anywhere. I have complained about this to the Opera support groups [opera.com] but they told me it wasn't possible to do a "complete" fake header. If you want that I guess you have to rewrite user-agent headers with a proxy.
Or use Mozilla and the UA Toolbar or UA Sidebar
-
Re:View SourceMozilla source generator: here
It generates source from the DOM too!
-
Go file Tech Evangelism bugs in Bugzilla
A whole bunch of pages that say if( !navigator ) { doSomeReallyCoolDHTMLStuff(); } Even though netscape 6.2 can do most of them.
These are the sites that need evangelizing to. Learn about Mozilla Evangelism, get a recent Mozilla build (mozillaZine reviewed builds are a middle ground between milestones and the latest nightly), and then begin filing bugs in Bugzilla's Tech Evangelism product.
but the DOM better be the same.
Repeat after me: "document.all" is not part of the HTML DOM.