77 Comments
- j3one, on 12/17/2007, -1/+23fail
- joelito, on 12/17/2007, -2/+16the most popular screen readers used by blind users don't like javascript very much. And of course, there's paranoid users that disable javascript for "security" reasons.
- Tippis, on 12/17/2007, -0/+11Actually, yes, it does, not because JS itself can do any damage to your system (unless the interpreter is bugged to hell), but it can quite easily launch other things that *will* hurt you, and do so without you knowing it.
Killing JS also kills most cross-scripting attacks and other attempts at ID- and session hijacking. - PolarZoe, on 12/17/2007, -2/+13jQyuery, seriously, this will make your javascript life much easier.
Has features for onclick and ondomload and stuff. - hifiDesign, on 12/17/2007, -0/+10Hmmm... the same people who create their own default style sheets... Geeks!
- jschrab, on 12/17/2007, -1/+11Please look into jQuery, Mootools and/or Prototype as soon as possible. Having yet another code base running around for onDOMready event handling won't help you.
The example here would be very brief with Mootools (for example - jQuery or Prototype would be just as brief, I imagine) ...
window.addEvent('domready', function() {
$$('#mylinks a').addEvent('click',function() { alert(this.title); return false; });
}); - inactive, on 12/17/2007, -0/+10Wait... VB is a scripting language? Ohhh, you mean VBScript... the bastard child of the most popular programming language in existence.
From your experience... I'd be willing to bet that "your experience" is a high school computer science class. - NinjaBoy, on 12/17/2007, -0/+9The cake is a lie.
- chedabob, on 12/17/2007, -3/+12I have noscript installed, which disables it on all sites except ones that I trust.
- emehrkay, on 12/17/2007, -0/+8If you have 100 links and you only want to apply action to two of them, you should apply some sort of hook to those two elements (rel, title, class, etc) and have the JS in the onload block select based on that hook and apply the elements to the links in that array...
- maexus, on 12/17/2007, -0/+7Do all phones use Opera Mini?
- jjustin01, on 12/17/2007, -2/+9What is really entertaining about a lot of coding "best practices", is they change from one person to the next and it always depends on who is giving the lecture. Last month, another "best practices" site said to not use handlers unless they were needed. This site is says to use them just to simply add an onclick event to your anchor tags.
What if I have 100 links on my page and I want to add an onclick event to just two of the links? This site makes it sound as if his/her methods of "best practices" would work the best when in fact his code would be more inefficient.
And yes, while I do agree that separating the layers of the application from one another is a great "best practice" sometimes, from an application performance stand point, it doesn't always work out that way.
Of course, this is always debatable since no one ever seems to agree, and of course I could always be wrong (depending on who replies). - inactive, on 12/17/2007, -2/+8use jQuery and get ***** done in an hour in what would take raw JS coders a day.
- Tippis, on 12/17/2007, -1/+7Because JavaScript has an undeservedly bad reputation -- the problem isn't with the language, but with the immensely inconsistent implementations across browsers. As a scription language (at least in the later versions, and most certainly in v2.0), it blows quite a few "real" languages out of the water in terms of what it can do.
The language is excellent -- the reputation (due to a history of flawed implementations and a, frankly, idiotic choice of name) is apalling. - xutopia, on 12/17/2007, -0/+5web crawlers
- hyperair, on 12/17/2007, -4/+8And that makes your browser more secure? Don't make me laugh. When the first Javascript virus emerges, please notify me.
- Zaggynl, on 12/17/2007, -4/+8http://www.phazm.com/images/dontpanic.png
ahaha - inactive, on 12/17/2007, -0/+3Good enough for Digg, Nintendo, IBM and others. Do you think you know better than these companies?
- pwim, on 12/17/2007, -2/+5Not all devices support javascript. For instance if I'm browsing the web using my phone.
- commentbot, on 12/17/2007, -2/+5I'm using Opera Mini and it DOES have Javascript enabled by default.
- maexus, on 12/17/2007, -0/+3I haven't used another library but love jQuery. It very fast at getting results I need.
- RoboDonut, on 12/17/2007, -0/+3Not necessarily security. Some people just don't like websites that decide to resize/move your browser window without reason, or this "Web 2.0" nonsense with it's crazy "DHTML"/Ajax.
- ChapStik, on 12/17/2007, -0/+2shouldn't be? You have noscript on?
- IllBeBack, on 12/17/2007, -1/+3Mmmmmmmmmmmm pie..............
- ChapStik, on 12/17/2007, -4/+6Zing!
- ell0bo, on 12/17/2007, -0/+2actually IBM was using Dojo when I was there last, although that was two years ago and maybe they smarted up. However considering how things were there and why I didn't return... I doubt it.
- emehrkay, on 12/17/2007, -1/+3I dont think that the argument is what is faster, but what is accessible/unobtrusive.
While having inline JS is easier to code, less of a memory footprint, and may execute the code faster (article is on ajaxian.com somwhere), in most cases it is seen as a thing of the past. If JS is turned off, I may still want my stuff to work, does not - MeatBiProduct, on 12/17/2007, -0/+2No one uses IE5 on the Mac - which is notorious for being broken and not running anything right. I don't know whats worse the fact that you tested it in IE5 or the fact that you actually came to digg to post about it. NO ONE USES IE5 ON THE MAC - PLEASE MOVE ON!
- maexus, on 12/17/2007, -0/+2That's like saying it's unnecessary overhead to have class and id's assigned and just use inline CSS. Seperate content, style and behaviour.
- jjustin01, on 12/17/2007, -0/+2maexus, you're missing the point. This has nothing to do with assigning a structured format to your code. This is about running event handlers on an unnecessary number of elements when you know specifically which two elements it will be.
This is especially true in cases where there will be large amount interactive JavaScript taking place and will very quickly hog memory. I realize the argument from your guys' standpoint. I do agree that is very critical to separate the layers of the application. And I am not suggesting inline code anywhere. What I am suggesting, however, is element specific code.
An example. I have to two divs I want to capture an onlick for. Rather then looping through the array of elements for every freaking DIV tag in the DOM, I could target those specific DIV tags by the ID's and capture the onclick them specifically. You could still do this through a JS file and not have any inline code whatsoever. It would be more efficient then looping through an entire array of a 100 or more DIV, A, etc. tags within the DOM. That is all I am saying. No inline code anywhere.
Does that make more sense? - chedabob, on 12/17/2007, -1/+3I don't just use it for the javascript protection. There's only so much ABP can do, NoScript handles the rest.
- emehrkay, on 12/17/2007, -1/+3same could be said for just about any JS library
- MeatBiProduct, on 12/17/2007, -1/+2please learn javascript before using a framework. The Javascript Definitive Guides from Oreilly are a good start.
Learning a framework first and javascript second is not. - thefinger, on 12/18/2007, -0/+1from a totally end-user point of view, how about a js implementation that doesn't make Digg go into that infuriating slo-mo when I log in with js enabled. This is a problem in Firefox, a bit less so with IE, and Opera least of all.
- jjustin01, on 12/17/2007, -0/+1The processing power on the client is not free if it causes people to have bad user experiences with your website and you lose traffic and that loss of traffic equates to loss of revenue.
- Terr01, on 12/18/2007, -0/+1Well, there's no technical reason that successful XSS attacks could not let an attacker make your browser transfer money to him from your online banking site of choice.
- scottschiller, on 12/18/2007, -0/+1Even simpler - use an "event delegation"-style approach. Christian Heilmann (Y! dude) has a blog post with some good info on this. Basically, you watch onclick() events at a high level (on the parent element of the 100 links you want, or the body etc.) Then when onclick() fires, you can check to see if the element is a target you're interested in (className matches what you want, or the node is a child of the parent you're targeting, etc.) This way, you only have one event handler and far less resources consumed - particularly for IE.
Chris also happens to have a rather funny-sounding domain name, bonus geek points.
http://www.wait-till-i.com/2006/09/24/event-handli ... - NinjaBass, on 12/17/2007, -0/+1Just run Linux. What's a virus?
- scottschiller, on 12/18/2007, -0/+1Gzip + YUI compressor FTW. (Recommended For all JS/CSS in fact, not just YUI.)
- ell0bo, on 12/17/2007, -0/+1I wouldn't consider myself a kiddie when it comes to JS and writing apps. JQuery is by far the best thing I've worked on, and it's really light weight. You want to add more bloat? it's easy to add extensions. I used to maintain my own JS library for years, but when IE 7 came out I had all these annoying little bugs that crept in. Now with jQuery I have that taken care of. I took the time to re do my entire library, and now not only does it run faster but it's a lot cleaner to look at. I am glad someone talked me into trying jQuery, I recommend you to too.
- Daniel15, on 12/18/2007, -0/+1I've never used jQuery... Is it any better than Mootools? I'm using Mootools at the moment.
- hwn67, on 01/11/2008, -0/+1My N95 uses a safari clone. No problems there...
- joelito, on 12/19/2007, -0/+1I don't know. But in one of my latest jobs the graphic designers didn't knew there was any other browser for their Macs until I started using Safari on those.
- MeatBiProduct, on 12/19/2007, -0/+1i think sites like youtube, digg, myspace, facebook, and more prove you wrong. They are all heavily JS'd out.
The point of a rich user experience isn't providing the user with bad experiences. Done properly you can handle tons of work client side and save your server for what its meant to do - provide data not process templates. - MeatBiProduct, on 12/17/2007, -0/+1Processing power on the client is free - processing power on your server is not.
- emehrkay, on 12/17/2007, -0/+1of course it isnt free. As an example; Digg eats up so much memory because of the way they have their js setup
- inactive, on 12/19/2007, -0/+1this make as simple
- ChapStik, on 12/18/2007, -0/+1And those 3 people are just looking for sites that break in IE5, not actually browsing with it.
- hwn67, on 01/11/2008, -0/+1It took me 2 hours to learn jQuery, it saved me 60 hours since.
Another promising project is php.js, using PHP functions in JavaScript can make life easier. Just found this yesterday:
http://digg.com/programming/Javascript_MD5 - MeatBiProduct, on 12/17/2007, -1/+2No but I also don't give a ***** what others are using. World of Warcraft uses XML and XSLT's and you don't see every site running around using that ***** so get ***** with your 'good enough for them then i should use it' mentallity.
Besides that - YUI is where its at XHR 4 LIFE. -
Show 51 - 76 of 76 discussions




What is Digg?
Browsing Digg on your phone just got easier with our enhancements to the