WebKit Page Cache II – The unload Event
Very interesting discussion of the problems the unload event poses for browser vendors. Introduction of the pageshow and pagehide events.
Events | Permalink
JavaScript elsewhere on the 'Net.
Includes:
22 September 2009
Very interesting discussion of the problems the unload event poses for browser vendors. Introduction of the pageshow and pagehide events.
Events | Permalink
11 September 2009
Useful overview of the (iPhone proprietary?) touch events.
Events, iPhone | Permalink
18 June 2009
Robert Nyman created a proper test suite + compatibility table for JavaScript 1.6-1.8 features. Useful!
Core | Permalink
15 June 2009
Stefan Kolb continues his series of tests of JavaScript libraries on mobile phones. This time he did the TaskSpeed tests on ten Nokia S60 phones.
Conclusion: Dojo again the fastest library; this time Prototype is the slowest.
Libraries, Performance, W3C Widgets | Permalink
22 May 2009
John discusses some new ECMAScript 5 features: strict mode and native JSON parsing. (It should be noted that IE8 is said to contain the latter already, though I haven't tested it yet so I can't say whether it adheres to the proposed implementation completely.)
Core | Permalink
21 May 2009
13 May 2009
Stefan Kolb, one of my co-workers at Vodafone, has conducted a selector performance test for seven JavaScript library versions in the Vodafone Widget Manager, which runs Opera Mobile, on ten different Symbian S60 phones.
For now it is clearly visible that some frameworks perform better than others in terms of DOM selection. By far the slowest framework in my tests across all devices was the YUI v2.7.0 framework. The fastest frameworks were the two version of the Dojo framework, with version 1.3.0 performing slightly better than version 1.2.3.
It is also clear from the results that the performance depends on the mobile device. The Nokia N73 was the slowest phone, no matter which framework was tested on that device. The fastest phone was the Nokia E66, closely followed by the Nokia N85.
Hopefully, the tested - well established - web frameworks will soon be optimized to perform better on mobile phones. After that, I am sure, they will be of great value for the mobile widget developer, just like they are for web developers today.
Obviously, we need many, many more performance tests before we can say which library is "best" on mobile phones. Still, today we've made a start.
Libraries, Performance, W3C Widgets | Permalink
4 May 2009
Jonathan admits he doesn't like the module pattern (use private variables and functions within a parent function, then return an object that contains public functions).
His main reason is that he wants to extend the modules later on, after the initialisation. Right now I'm wondering why we couldn't just add all functions we need to the initial function. As a reason, Jonathan quotes "Aspect-oriented Programming"", a technique I've never heard of.
For the moment I disagree with Jonathan, though that's partly because I don't have enough information.
JavaScript | Permalink
Tim Cameron Ryan has written a script to work around the differences between an IE Text Range and a W3C Range. I applaud his courage; I once considered doing this but the incompatibilities were terrible and I decided I needed a little more practice; practice I never got because my career started moving away from production coding.
DOM, IE | Permalink
18 April 2009
Differences in JavaScript implementation between IE8-as-IE8 and IE8-as-IE7.
IE, JavaScript | Permalink
13 April 2009
Ajaxian gives a useful overview of where we stand with regard to ECMAScript 5.
Core, Standards/W3C | Permalink
4 April 2009
Kangax explains how to detect whether browsers support events.
The trick is that, say, document.onclick
exists as a property even if no event handler is set (except in Mozilla). Read out whether the property exists, and you know if a browser supports an event. (It's slightly more complicated than that, but not much.)
Events | Permalink
3 April 2009
Palm now allows you to apply for a beta version of the webOS SDK, which includs the Mojo library. Maybe interesting; currently I'm wondering if I should sign up. (I wouldn't have the time to create a full app anyway, and I'm wondering what the SDK is worth without access to an actual Palm Pre.)
Anyway, I continue to be mildly impressed by Palm's wholesale gamble on the world of web development.
Libraries, Palm | Permalink
Peter Nederlof points out an interesting trick: you can overload the + operator all by yourself by messing with toString()
. Peter uses the trick to add vectors using just a +.
Interesting trick.
Core | Permalink
24 March 2009
Dean Edwards explains a tricky bit of scripting: how to prevent an error in one event callback (say, a load or DOMContentReady event) from blocking another event callback.
Not only is this useful in and of itself, but it's also gratifying to see that Dean
So I expect all the stuff we discussed over beers and on mailing lists to be blogged forthwith. Starting now.
Events | Permalink
24 February 2009
As it says. Useful info.
JavaScript, Opera Mobile/Mini | Permalink
3 February 2009
Chris Mills has published the JavaScript part of the Web Standards Curriculum, which includes my article about the principles of unobtrusive JavaScript.
JavaScript, Reference | Permalink
19 January 2009
Useful overview of the possibilities for creating web applications on various mobile phones.
Libraries, Mobile | Permalink
9 October 2008
Rakesh Pai researches eval()
and reports some truly curious findings; for instance a difference between plain eval()
and window.eval()
when they're used in an object method.
Required reading for anyone interested in JavaScript Core.
Core | Permalink
7 October 2008
The YUI team has taken my research into delegating the focus and blur events and included it in the brand new YUI 2.6.0
Use of the technique turned out to matter especially for creating and removing modal dialogs. When creating such a dialog, all focus events elsewhere on the page have to be redirected to it; after all the point of a modal dialog is that it cannot lose the focus except when you click on the Close button.
Until now YUI set a focus event on every single element on the page, an action that's costly in terms of performance. However, now they can just set one generic event at (presumably) document level, and that brings modal dialog creation time back by about 50%, and cleanup time by about 98%.
Now THAT's what I call performance gains. Cool work.
Events | Permalink
9 September 2008
With a new browser war looming, and JavaScript being the main battleground, the quality of JavaScript benchmarks becomes more and more important. John Resig takes a look at the three most important ones.
Benchmarks, JavaScript | Permalink
20 June 2008
A comparison of debuggers created by the browser vendors.
Browsers, Debugging | Permalink
17 June 2008
Interesting piece on the new Safari JavaScript engine (SquirrelFish), and why it's faster than the old one.
JavaScript, Safari | Permalink
17 April 2008
James Edwards repeats a few arguments against JavaScript libraries that are never far from my mind. In this case, his annoyance seems to derive from script authors who don't know how their own scripts work; and that's something I wouldn't like, either.
Nonetheless the whole To Use or Not To Use discussion remains extremely complex. I used to speak against libraries at every opportunity; nowadays I'm not so sure any more. But while reading James's piece I again feel myself sliding back to a strict No Libraries approach.
The final word hasn't yet been spoken.
Libraries | Permalink
Two and a half year after my failed addEvent recoding contest, filosofo posted an ultra-short function that mends the this
problem.
Also, he explains why my contest failed: my requirements were too strict. Filosofo used a trick that precludes a removeEvent
function from working, because he never needs one. Truth to tell, I rarely need one either, though it's absolutely indispensable in my recent events test pages.
All in all this is interesting to read, for all its brevity.
(Via Scott Andrew.)
Events | Permalink
14 April 2008
John Resig unveils a new JavaScript performance test. Very interesting.
Benchmarks, JavaScript | Permalink
4 April 2008
Brendan Eich gives an overview of early JavaScript history.
History, JavaScript | Permalink
20 March 2008
James Edwards is quite right to point this out once again. Collections, such as those returned by getElementsByTagName()
, are not arrays. In many cases it makes sense to convert them to an array, but you lose the dynamic nature of a collection. Even that's not terrible, but you should be aware of all these facts.
Core | Permalink
21 February 2008
Two years ago I wrote an entry about compareDocumentPosition()
and how it can overcome Firefox's annoying disregard of the useful contains()
method.
Now it turns out that John Resig has been studying compareDocumentPosition()
ever since, and has come up with a way to emulate it in IE. As usual with such ideas, once you understand what's going on it's extremely simple and you're left wondering "why didn't I think of this?".
While he was at it he also rewrote my getElementsByTagNames() function.
Great work.
DOM | Permalink
13 February 2008
More data on constructors and prototypes. For me it's hard to follow since I don't know Java so I can't judge how much (or little) JavaScript resembles Java.
Core | Permalink
11 February 2008
John discusses XPath and its place in JavaScript libraries. Although in general XPath seems to be fast, he's worried about encountering incompatibility problems. These problems might mean that all libraries need both an XPath module and a regular DOM module for the forseeable future, which makes maintenance harder.
Browsers, Libraries | Permalink
Chris explains the five steps you have to take before turning any of your own scripts over to the next guy.
I suppose that most of my scripts don't obey every single of these five steps. Let's keep them in mind when I publish a new one.
JavaScript, Theory | Permalink
John talks about performance testing JavaScript libraries and how not to go about it.
JavaScript, Performance, Tests, Theory | Permalink
28 January 2008
Drew McLellan takes a look at JavaScript libraries and the versioning switch.
With version targeting, IE7 will never go away. Just as browsers are born, they must also die and make way for the next generation.
That's an interesting thought I haven't yet seen anywhere else. Good argument.
IE, Libraries, Theory | Permalink
14 January 2008
John is preparing for his next book and is wondering if he should treat memory leaks. IE6 was infamous for its memory leaks, but the problem has been solved in IE7 and IE6 is on the way out. Should a description of this problem still take valuable book real estate?
Personally I think that memory leaks should still be treated, although a detailed description of the IE6 problems is not necessary any more by the time the book is released. A short summary might be useful, though.
Besides, other browsers are rumoured to have memory leaks, too. I'd love to have a solid description of these problems—or a statement that despite rumours these browsers have in fact no problems.
So my answer is Yes, treat them. Keep the treatment short, except for problems that creep up very frequently.
Browsers, JavaScript | Permalink
Ian Hickson asks for our help in filling the last 16 questions of the Acid 3 (JS) test. If you have time on your hands and access to Firefox and Safari trunk builds, participate.
Browsers, JavaScript, Tests | Permalink
10 January 2008
John Resig explains cross-site XMLHttp. The principle is simple: someone offering data may opt to add a header that says which other sites are allowed to download and play with the data.
A few months ago I mused about something like this, but I didn't post anything about it since I couldn't (and can't) judge the security consequences. Now the Firefox team says there aren't any (which seems to be implicit in them incorporating this feature in FF3), which is good enough for me.
Data Retrieval | Permalink
12 December 2007
Simon starts evangelising Comet, a system for continuously pushing JavaScript to the client. Although the idea is not new (I remember an experiment by Scott Andrew somewhere in 2000/1), it seems to have been set up thoroughly now.
Let's see where it's headed.
Data Retrieval | Permalink
4 December 2007
Liorean gives a very useful overview of who said what in the increasingly impossible-to-follow ECMAScript 4 debate.
Core, Linkdumps | Permalink
Dustin gives tons of useful advice to beginning JavaScripters.
JavaScript | Permalink
Chris gives tons of useful advice to beginning JavaScripters.
JavaScript | Permalink
22 November 2007
Ajaxian follows up Chris's recent Seven rules of unobtrusive JavaScripting by interviewing him.
JavaScript | Permalink
15 November 2007
John Resig creates a map of the confused jumble JavaScript is right now. Study it carefully and impress your friends with your detailed knowledge.
JavaScript | Permalink
Dustin is not happy with the proposed JavaScript 2.0, largely because it makes JavaScript more like Java.
I know about the fight going on between (apparently) Mozilla/Adobe vs. Microsoft/Yahoo! about the spec, but I'm not sure what the actual issues are. Therefore I like this sort of opinion pieces: they show what people on both sides of the dividing line think.
Now let's hope for an opinion piece that defends the proposed changes in easy language.
Core | Permalink
11 November 2007
A valiant try at defining the browser incompatibilities surrounding the key events. Yes, this is complicated. In any case I'm glad somebody has done some work; I'll probably use this page once I get back to describing the key events and their problems.
Events | Permalink
2 November 2007
John calls attention to some changes in JavaScript Core that will gradually become supported. I especially like the this
propagation.
Core | Permalink
28 October 2007
John Resig's slides from his presentation at the Ajax Experiences. This sort of overview is SO useful.
Libraries | Permalink
20 October 2007
Benchmark tests for run times of low-level JavaScript functionality in the four major browsers. Overall ranking:
The results of my own tests tend to swap Safari and Firefox, but they're different sorts of tests. In any case we're one step closer to understanding performance issues in the four major browsers.
Benchmarks, JavaScript | Permalink
Dustin takes issue with ugly DOM interfaces; especially those that require endless lists of parameters nobody ever uses; for instance window.find
or initMouseEvent
.
The most striking example remains the third argument of addEventListener
: people rarely use event capturing, so why not make this argument optional with the default set to false
(bubbling). I agree completely.
DOM | Permalink
17 October 2007
Neil Roberts takes a stab at defining the thin line between well-modularised and obfuscated JavaScript.
a good rule of thumb is that each parameter should always do the same thing. [...] If you have a parameter named
url
, go ahead and allow it to be a variety of object types, as long as they all indicate URLs. But once you start letting a parameter be a URL or a date, and you figure out which it should be based on variable analysis, you should start worrying.
No doubt there are many more such rules; I'm glad somebody is attempting to describe them.
JavaScript | Permalink
11 October 2007
There is some discussion going on about using custom attributes. Alex Russell uses them in Dojo (and I myself have been using and promoting them since 2003). First Aaron Gustafson criticized him mildly, Aaron's main argument being that you can use a custom DTD.
Now Dan Webb weighs in. He goes further than Aaron: he doesn't want custom attributes at all. Instead, he points to the possibility of using good old class
to store the data the scripts need. Possible, but when you've got a lot of data to store, it can become ugly in a hurry.
All in all, right now I tend to side with Alex, but I'll read the arguments of the opposite camp with care.
Maybe we can get around the problem by officially specifying a bunch of attributes that are expressly meant for storing script data. I'd like more than one; ideal would be something like:
<element scriptData1="retrospect" scriptData2="opaque" />
I don't think "scriptData" is the best name, but the idea would be that there's an infinite set of attributes to hold script data; and yes, that would mean that scriptData999999
would also be allowed.
Anyway, this discussion has hardly started up yet. I'm curious how it will proceed.
JavaScript, Standards/W3C | Permalink
28 September 2007
Stuart's solution for the onload problem.
onload | Permalink
14 September 2007
Alex Russell:
Browser.Next list of 10 issues that would give Ajax libraries a break and let app authors worry less
Interesting.
Browsers, JavaScript | Permalink
19 July 2007
John Resig explains getters and setters. I, for one, needed that explanation because I didn't have the faintest idea what they are. Now that I understand them I agree they're cool. Unfortunately they don't work in IE.
Core | Permalink
4 July 2007
John Resig thinks it's time for JavaScript to take the final step toward being a fully fledged programming language.
JavaScript | Permalink
16 June 2007
The resize
event fires also when the <body>
element is resized. I knew that, but I forgot it. Thanks to Jonathan for reminding me.
Events, IE | Permalink
10 June 2007
A new website dedicated to the evolving ECMAScript specification.
Core | Permalink
Over on the YUI blog Nicholas Zakas takes a look at dynamically generating a <style>
element. Appending a text node with new style rules works in all browsers but IE; while in IE you should use the cssText
property of the element.
DOM | Permalink
9 June 2007
1 June 2007
John Resig on JavaScript Core updates in the upcoming Firefox.
Core | Permalink
30 May 2007
Do we use img.src = 'value'
or img.setAttribute('src','value')
? It appears to be a simple question, but there's much more to it than meets the eye, I think. Comment 34 contains my answer.
DOM | Permalink
17 May 2007
Dustin Diaz on prototypal inheritance. Although I don't pretend to understand all of it (I'm not really a programmer, and certainly don't have any kind of formal education in programming), I fully support his basic message that JavaScript is JavaScript, and should be approached as JavaScript, and not as, for instance, Java. If you want to write JavaScript, learn JavaScript.
Core | Permalink
16 May 2007
At XTech in Paris Simon compared the Big Four libraries. Here are his slides. Interesting, altogether.
Libraries | Permalink
11 May 2007
Douglas Crockford once more explains hidden properties in JavaScript objects. Every object not only has its own properties that you define for your own reasons, it also inherits quite a few methods and properties from other objects, ranging all the way back to the primordial Object object.
These inherited methods and properties will give false positives: for instance, every object you define has a constructor
property. If your script doesn't make exclude these inherited objects explicitly, you have a problem.
Fortunately there is the hasOwnProperty()
method that returns true
if a property has been defined on the object itself; false
if it's inherited from another object.
Core | Permalink
9 May 2007
Finally a good summary of accessing a document inside an iframe.
DOM | Permalink
2 May 2007
Ajaxian warns against the latest round of Ajax bullshit; this time from Sun. Apparently an otherwise sensible, even profoundly accomplished, programmer wants to write a JavaScript "self-supporting Web programming kernel" (whatever thay may be; sounds like marketing-speak to me) that allows people to ignore those nasty, nasty details of HTML, CSS, and JavaScript when writing Ajax applications.
What annoys me most is not so much the idea itself, but the breathless arrogance that speaks from it: I'm an accomplished programmer, so accomplished in fact that I don't have to learn new langauges when I want to do something I can't do in the languages I already speek. I don't want to learn something as easy as HTML/CSS, so I'm going to re-re-re-invent the wheel.
Dion Almaer observes that we should be glad that this latest round of idiocy does not require us to learn a new programming language. The worst thing about it is that he's right.
This message may be a hoax; Ajaxian refers to a cio.in article, which generally refers back to infoworld.com, where nothing can be found about this latest stupidity.
Libraries | Permalink
Detailed treatment of how browsers handle events, with emphasis on the timing: exactly when does an event handler fire and what does the user notice?
Also treats batches of events (mousedown-mouseup-click), event queuing (when an event occurs while another event handler is still running, the browser waits for the earlier event handler to quit), how timeouts are somewhat like events, and many, many more interesting details.
Required reading for any JavaScripter.
(Via Simon.)
Events | Permalink
A practical example of catering for screen readers when creating a nify JavaScript effect. Useful tips.
Events, Screen readers | Permalink
27 April 2007
For once I disagree with Douglas Crockford: fall-throughs in switch
statements are extremely useful. He doesn't actually deny that, but states that they can lead to complicated bugs; a statement that would have been stronger for some proof.
Take this simple function from Form Validation. It uses a fall-through because the types text, textarea and select-one should be treated the same:
function isRequired(formField) { switch (formField.type) { case 'text': case 'textarea': case 'select-one': if (formField.value) return true; return false; case 'radio': var radios = formField.form[formField.name]; for (var i=0;i<radios.length;i++) { if (radios[i].checked) return true; } return false; case 'checkbox': return formField.checked; } }
My question is: what's wrong with this function? Which errors could occur? The only thing I can think of is the occurrence of an as-yet unknown type
.
I'd love some clarification on why this is bad coding practice. I don't see the problem, but I don't want to doubt Douglas' word, either.
Core | Permalink
Jeremy on the JS library panel at Web 2.0 Expo. I agree with the idea of the gliding scale from libraries meant to make websites to libraries meant to build applications. Needless to say I'll give the latter a wide berth, and I STRONGLY disagree with the idea of using Java to write JavaScript. If you want to write JavaScript, learn JavaScript.
Libraries | Permalink
24 April 2007
Dustin Diaz shares a few important tricks. His addListener
elegantly solves the problem of the missing this
keyword in Microsoft's attachEvent
, and his tip to include a method in getElementsBySomething
is worthwhile, too.
Core | Permalink
21 April 2007
Chris has a simple solution for creating connected select boxes in an unobtrusive way: use optgroup
. Interesting thought.
DOM | Permalink
15 April 2007
Shaun explains how a <base>
tag can mess up scripts that modify the page header before it's loaded completely.
DOM | Permalink
11 April 2007
Andrew Dupont divides browser issues into two groups:
canvas
?), which are addressed by object detection.I don't like browser detection for beans, but I'm forced to admit he has a point. The article also contains a few interesting technical details about the browser detection used in Prototype.
Browsers, JavaScript, Theory | Permalink
8 April 2007
The nuts and bolts of keeping a foldout menu keyboard accessible.
Accessibility, Events | Permalink
3 April 2007
Chris discusses and dissects ways and means of looping through an array. I still use the first, simplest way because I'm not convinced reading out the array's length every loop takes a lot of time, but it's useful to have such an overview.
Core | Permalink
2 April 2007
Jeremy on Ajax and Flash, and the continuum between web sites and web applications. When you're working on the application side, Flash becomes a serious option, while Ajax is generally harder to code and less accessible.
Data Retrieval, Flash, Theory | Permalink
David Flanagan discovers yet more weirdness in IE's window.event
.
Events | Permalink
25 March 2007
Ian Lloyd discusses ways and means of using acceskeys that don't interfere with 'normal' browser functions (like Ctrl+R = Reload). He wants to allow users to set their own accesskeys through a little script. Interesting idea.
Accessibility, JavaScript | Permalink
Dean isn't done yet: here are his rules for library authors. They all seem so simple, but are frequently broken by authors with more technical prowess than common sense.
Libraries | Permalink
Nicholas Zakas offers some advice on choosing a JavaScript library. As far as I can see Dean's Base scores well on all of these points.
Libraries | Permalink
Dean Edwards finally unveils his Base library which he already mentioned to me back in June 2006. No documentation, obviously. The library seems to concentrate on getting advanced standards to work in browsers that don't support them yet.
Libraries | Permalink
20 March 2007
Dan talks about Flash vs. Ajax, and takes Jonathan's presentation at SxSW as a starting point. Dan investigates the reasons he decided to quit Flash programming, and notices many of these reasons have meanwhile been solved.
Data Retrieval, Flash, Theory | Permalink
9 March 2007
As it says. Curious Firefox features may pose a threat to 'secure' JSON.
(Via Simon.)
Data Retrieval | Permalink
8 March 2007
Scott Andrew's ways of detecting newbies at work in JavaScript.
I've learnt one other trick for distinguishing newbies and pros: ask them the difference between this
and self
. Usually people who just claim to be excellent scripters don't know the answer, while real pros do.
JavaScript, Skillset | Permalink
Some facts about timer implementations, and why 10ms is the lowest practical limit for setTimeout
. I found that out by experimenting (and fortunately this nugget is in The Book), but I didn't know why this was the case.
Browsers, JavaScript | Permalink
Interesting thoughts on a tricky subject. A bug fix in a browser can cause problems in libraries. In addition, it turns out certain object detections (for instance if (element.getAttribute)
) can fail in some browsers. I didn't know that.
Libraries | Permalink
10 February 2007
Useful overview of where JavaScript and accessibility stand.
Accessibility, JavaScript, Theory | Permalink
4 February 2007
Scott Andrew points out bugs in Safari's handling of dynamic <script>
elements.
JavaScript, Safari | Permalink
23 January 2007
A call for screen reader users willing to test the recently published virtual buffer update trick (see under 20 January).
Accessibility, Data Retrieval, Screen readers, Tests | Permalink
20 January 2007
How XMLHTTP came to be. By the inventor.
Which is the real explanation of where the name XMLHTTP comes from- the thing is mostly about HTTP and doesn't have any specific tie to XML other than that was the easiest excuse for shipping it so I needed to cram XML into the name (plus- XML was the hot technology at the time and it seemed like some good marketing for the component).
Interesting read all in all, especially because it shows once again that this sort of stuff isn't planned: you create something for your own reasons, but suddenly it takes on a life of its own.
(Via Nate.)
Data Retrieval, History | Permalink
About some interesting Jaws features. Summary:
Popular screen readers use a virtual buffer to allow users to interact with web content, whereby the virtual buffer provides a mechanism for screen reader users to interact with web content. This article uncovers undocumented behaviour in JAWS 7.1 and later, which allows web developers to build Ajax applications that update the virtual buffer without any interaction from the user.
Delves deeply into Jaws's bowels. Not for the fainthearted.
Accessibility, Data Retrieval, Screen readers | Permalink
16 January 2007
Chris Heilmann on sucky JavaScript books and tutorials. Includes a few interesting thoughts on the nature of education and why it's sometimes important to quickly give a simple example, even when that requires you to use document.write()
or similar junk.
JavaScript | Permalink
12 January 2007
...and Jeremy again.
Building up your own library, on the other hand, is something I wholeheartedly approve of. I’m pretty sure it’s something that just about every developer does anyway, but it really is a great way of accumulating wisdom… wisdom being knowledge over time.
Agreed. In fact, I'm steadily working on a few useful functions of my own, and although I'll never call it a library (I'm thinking of "utility file"), I'll publish it when I'm ready.
Libraries | Permalink
Dan Webb on JavaScript libraries.
I’m a firm believer, especially with JavaScript, that simple is best. File size / download time arguments aside, the less code you can get away with having the browser parse and execute the better off you are. Less for the browser to do. Less to go wrong. Less to try to understand.
Agreed. Dan continues by listing a few essential functionalities that are so totally useful that it's worth having a library for.
Libraries | Permalink
Some tips from the MSIE team.
Core | Permalink
So true: JSON can be used in any environment; it's not restricted to JavaScript.
However, there's an important social issue here, which is reflected in Dave Winer's post on JSON: people outside the front end community aren't (yet) used to it, so they will tend to underestimate it.
That problem will solve itself, although it might take a few more years.
Data Retrieval | Permalink
19 December 2006
Jeremy's thoughts on JavaScript libraries.
There’s a lot of talk about JavaScript libraries, including a lot of hype and cheerleading, but I think that maybe the discussion is disproportionate to the amount of people actually using libraries.
Spot on. As Jeremy says, a quick and non-scientific poll @media showed that only a minority of JavaScript developers use a library; the others just code by hand.
But JavaScript libraries are cool nowadays and will remain so until the Ajax hype blows over.
Libraries | Permalink
Chris summarises what's wrong with JavaScript libraries today.
Libraries | Permalink
8 November 2006
Now this is pretty cool. Brendan Eich announces that Mozilla and Adobe are going to cooperate in the further development of JavaScript interpreters. This post gives a more high-level overview of what's going on.
What does this all mean? Let's start with users of Firefox and other applications based on Mozilla technology. They'll get future versions of Firefox and other Mozilla-based products that will run JavaScript-based applications significantly faster, [...]. (In its own testing Adobe has seen up to a ten times speedup of ActionScript applications due to the introduction of the AVM2 technology.) Since Firefox and Firefox extensions are partly written in JavaScript (as are other applications built on Mozilla's XUL technology), users will also likely see performance gains in some areas of Firefox itself.
Sounds great; bring it on.
JavaScript | Permalink
7 November 2006
1 November 2006
Several possibilities for speeding up the page loading.
JavaScript | Permalink
Douglas Crockford proposes a modification to JavaScript's Same Source Policy in order to make cross-domain data retrieval possible.
Data Retrieval, HTML | Permalink
25 October 2006
David Flanagan discovers that an event object is passed to event handlers set with the Microsoft proprietary attachEvent()
method. This object is not the same as window.event
, but contains the same properties.
Everybody kind of assumed that IE only used window.event
, but nobody ever seems to have tested it. My book doesn't mention this fact, although I don't think I ever denied the existence of these event objects, either.
I wonder how many more of these curiosities are hidden deep in the browsers' bowels.
Events, IE | Permalink
19 October 2006
A W3C DOM vs. innerHTML benchmark. Its conclusions match mine: innerHTML
is much faster than "real" W3C DOM methods.
Benchmarks, DOM | Permalink
It turns out that JSON requires you to use double quotes everywhere, even for your property names. JavaScript object literal notation does not require this; but it turns out JSON is a subset of the JS object literal.
I didn't know this; and as a consequence my book doesn't treat this rule. In fact, I have doubts about its practical necessity. A JavaScript object is a JavaScript object, whatever kind of quotes you use. OK, with the wrong quotes it isn't "JSON" any more, but all scripts will happily read and parse the objects, and do whatever they need to do.
Data Retrieval | Permalink
11 October 2006
Excellent overview of recent thinking on Ajax and accessibility.
Accessibility, Data Retrieval | Permalink
Stuart points out an important usability requirement of Ajax sites: no discernible load time.
There is no point in using Ajax if you have to pop up a “Loading” screen and wait ten seconds when a link is clicked.
Spot on.
Data Retrieval, Usability | Permalink
28 September 2006
Douglas Crockford explains the finer points and dangers of the for in
loop.
Core | Permalink
22 September 2006
IE 7's JavaScript now runs much, much faster than before. Dean Edwards has the details; and Chris Wilson has confirmed them.
IE, JavaScript | Permalink
13 September 2006
An onFontResize event handler created by Chris Heilmann and Lawrence Carvalho.
I had a similar idea a few months ago, but never did anything with it because I couldn't find a way around the inevitable interval. Essentially you have to continue running a check function for as long as the user stays on the page. That's no problem if you have only one such function, but what if we get many more custom events like this, and the browser has to check dozens of them every 1/5th second or so?
Regardless of this potential problem it's an interesting idea.
Events | Permalink
12 September 2006
Ryan Campbell does some benchmark tests with Prototype's Enumerator, and finds it's significantly slower than a traditional, non-library approach.
If basic JavaScript will do the task, then use basic JavaScript.
Benchmarks, Libraries | Permalink
6 September 2006
Dave Hyatt on parsing order. Are CSS files read first, while the HTML is stalled, or are they read at the same time?
Browsers, CSS, JavaScript | Permalink
29 August 2006
The IE team gives JavaScript performance tricks. Some are old hat for advanced scripters, but others are new (at least, to me). Interesting read overall.
IE, JavaScript | Permalink
25 August 2006
Is relying on class names to trigger advanced scripts wrong? Dustin Diaz seems to think so, but I don't think I agree.
JavaScript | Permalink
23 August 2006
Dan Webb and Luke Redpath unveil their unobtrusive JavaScript plugin for Rails. It's a necessary one, since Rails' native JS implementation is ugly and uses inline event handlers for about everything.
JavaScript | Permalink
14 August 2006
Drew McLellan feels JSON is superior to XML. I'm not sure I agree, but it's useful to have a few major arguments concentrated in one entry.
Data Retrieval | Permalink
James Edwards creates a Wolfenstein-like labyrinth with CSS borders and some JavaScript. Quite extraordinary; even though it won't find a practical application any time soon.
JavaScript | Permalink
7 August 2006
David Flanagan's undowithoutable Def Guide is now available in the 5th edition. Months ago I did some light tech editing on a few chapters, but quite frankly I can't remember much of it. Another book got in the way.
Books, JavaScript | Permalink
5 August 2006
On the difference between an object literal and a JSON string. I wonder if this difference really exists in practice.
Core | Permalink
Joel Spolsky discovers JavaScript functions are really values. That opens a neat bag of tricks!
Core | Permalink
JavaScript benchmark tests. Result (Win only): Opera super-fast, IE OK, Firefox slightly less OK.
Benchmarks, JavaScript | Permalink
28 July 2006
responseXML is not available when you use document.domain to allow pages from several subdomains to communicate.
Data Retrieval, Mozilla | Permalink
25 July 2006
24 July 2006
Gez Lemon studies the mouseover event in screen readers. Part 1 of a series; I can't wait for the next installment.
Events, Screen readers | Permalink
18 July 2006
Yes, please! Let's just write JavaScript and forget about all those bloated frameworks.
JavaScript | Permalink
Useful tips and tricks from Chris Heilmann. Maybe not surprising for senior gurus, but definitely worth a read if you rank lower than that.
JavaScript, Theory | Permalink
11 July 2006
Jeremy on learning JavaScript. Bottom line: if you want to use JavaScript, learn JavaScript. I completely agree.
JavaScript, Society | Permalink
3 July 2006
Chris has some preview goodness.
Books, JavaScript | Permalink
29 June 2006
As it says. I read only a few of them, and wrote one of them.
Accessibility, Data Retrieval | Permalink
26 June 2006
Simon repeats the points he made during the @media panel.
Conferences, JavaScript | Permalink
22 June 2006
Dojo, Prototype, Mochikit or the Yahoo UI Library? Who's going to win the JavaScript library World Cup? Dan Webb ponders the question.
JavaScript | Permalink
20 June 2006
Jeremy explains the basics once more; this time on ALA.
JavaScript | Permalink
13 June 2006
What the WaSP DOM Scripting Task Force has done this year.
JavaScript, Linkdumps, WaSP | Permalink
12 June 2006
List of Ajax patterns; similar to what I myself am looking for in my QuirksBlog entries, but a bit more low-level.
Data Retrieval, Theory | Permalink
11 June 2006
9 June 2006
A tip from the MSIE team: in IE 7, use the native XMLHttpRequest object, and not the ActiveX objects you need for IE 6 and lower.
Data Retrieval, IE | Permalink
2 June 2006
Dean takes a stab at categorizing JavaScript knowledge.
Fun, JavaScript | Permalink
26 May 2006
Brendan Eich's presentation on JavaScript 2.0, which I had the good fortune of attending in Amsterdam.
Core | Permalink
25 May 2006
'We explain the fundamental issues; how to inform users of assistive technology that a change has taken place, and how they can interact with the content. To illustrate our findings, we summarise the behaviour of popular screen readers.'
Accessibility, Data Retrieval, Screen readers | Permalink
13 May 2006
Liorean discusses and criticises the new W3C Selector API.
JavaScript | Permalink
9 May 2006
Again a frameworks article. Frameworks *can* suck, is the message.
Libraries | Permalink
Eric complains: 'I just don’t get all these new-fangled programming frameworks. Is something wrong with me?' No, there's something wrong with the frameworks. Several commenters note that the same problem exists in JavaScript. What goes around comes around. Maybe the latest batch of JS libraries have already passed their zenith.
Libraries | Permalink
Surprisingly, Joe's conclusion is 'Everybody could do everything. It just wasn’t all that convenient.'
Accessibility, Data Retrieval, Screen readers, Tests | Permalink
4 May 2006
James Edwards discusses screen reader JavaScript support. Chaotic.
Accessibility, Events, Screen readers, Tests | Permalink
13 April 2006
Dustin Diaz explores some curious-looking Core constructs.
Core | Permalink
12 April 2006
Agreed. Nobody uses it anyway, but it's useful to have one entry with all arguments against it.
Core | Permalink
4 April 2006
Dan wonders whether memory leaks are such a big deal. Sure, they occur, but does it really matter in a lightly scripted page? Interesting question.
DOM, IE | Permalink
2 April 2006
Dean Edwards responds to Alex. I agree with his criticism of the specific example, and right now Dean is the Supreme Honcho of Onload, so this entry is well worth reading.
DOM | Permalink
Alex Russell proposes a non-valid hack. In general I agree with him, but I don't like his specific example.
DOM | Permalink
15 March 2006
Erik Arvidsson's little library that ports the Mozilla Array and String extensions to other browsers. Useful.
Core | Permalink
Simon explains JavaScript concisely and with slides.
JavaScript | Permalink
Which screen readers support which events?
Accessibility, Events | Permalink
22 February 2006
20 February 2006
How to write an advanced form validation script that's usable in a screen reader. The trick is very simple.
Accessibility, DOM, Screen readers | Permalink
17 February 2006
In which Tim Bray discusses the advantages of Ajax from a server side perspective.
Data Retrieval | Permalink
15 February 2006
Yahoo! goes community, too. It has released a user interface library and a design pattern library. Since I'm not terribly interested in JavaScript libraries, I'll spend most of my attention on the second one, which looks very promising and ties in with John Allsopp's ideas along the same line.
JavaScript, Society, Usability | Permalink
I'm not likely to use any of them, but this is nonetheless a useful list.
Libraries | Permalink
13 February 2006
On generating new script tags and downloading new scripts.
Data Retrieval | Permalink
6 February 2006
A little DOM tutorial for innerHTML junkies. Interesting approach.
DOM | Permalink
5 February 2006
4 February 2006
Not entirely fair. The current beta focuses on CSS issues, and not on JavaScript issues. There are few JavaScript changes.
IE, JavaScript | Permalink
31 January 2006
28 January 2006
'Drag and drop on the web is rubbish.' Agreed, mostly.
JavaScript, Usability | Permalink
27 January 2006
About some of the more curious aspects of JavaScript nested functions.
Core | Permalink
26 January 2006
How to enable the Back button in Ajax applications.
Data Retrieval, Usability | Permalink
An interesting example of caching JSON requests. Just make the next request before the user actually commands it, and your application will appear to work smoother. Of course this is only possible in a linear situation.
Data Retrieval | Permalink
23 January 2006
An updated cursor position script. It turns out that for IE's sake in Strict Mode you have to subtract clientLeft/Top.
Events | Permalink
19 January 2006
Despite the title this post is really about the problems the load event can have (takes too long), and problems in IE 5.0 and 5.5 when you directly include your JavaScript calls at the end of the body (document.body not yet available).
Events | Permalink
18 January 2006
A proposed measurement for network latency of AJAX applications. Interesting read.
Data Retrieval | Permalink
On Java-style inheritance in JavaScript. Although personally I don't really see the point of adding inheritance to JavaScript, this article gives a nice overview and has a few interesting comments.
Core | Permalink
Dan Webb studies JavaScript coding styles and gives a list of his own preferences. Might be an interesting starting point for a discussion.
JavaScript, Theory | Permalink
Interesting. Since prototype is the single library on my to-study list, I'll keep this reference around.
Libraries | Permalink
David Flanagan on the defer attribute of the script tag. Microsoft's implementation is acceptable due to a certain vagueness in the spec.
HTML, JavaScript | Permalink
10 January 2006
A useful little trick, but be sure to read Stuart's caveat in comment 3.
Core | Permalink
9 January 2006
Some useful examples of using HTTP status code in AJAX calls.
Data Retrieval | Permalink
4 January 2006
Ajax breaks the Back button. Some observations and possible solutions from Isolani.
JavaScript, Usability | Permalink
As it says. David Flanagan worries about the exact time DOM elements become available to scripts. Only onload? Or also when you include the script at the bottom of the page? Please leave a comment if you have anything useful to say.
JavaScript | Permalink
23 December 2005
Dave Johnson did some benchmarks for W3C DOM, JSON and XSLT as Ajax response formats. His conclusion is that XSLT is by far the fastest method. I hope he gets around putting his test pages online soon, so that people can verify this conclusion.
Benchmarks, Data Retrieval | Permalink
17 December 2005
With interesting information about AJAX and JSON in general, as well as the Yahoo APIs.
Data Retrieval | Permalink
16 December 2005
Yahoo goes JSON. The JSON solution begins to become interesting. I didn't realize it can be used to ignore cross-domain security, but now that Simon spelled it out it's obvious.
Data Retrieval | Permalink
12 December 2005
Yet more documentation of prototype functionalities.
Libraries, Reference | Permalink
8 December 2005
Dean Edwards starts a series of JavaScript tips. This one is interesting, and although I'm going to think about it before implementing it, it could very well be an important improvement.
JavaScript | Permalink
5 December 2005
Alex Bosworth about when to use Ajax and when not to. Useful overview.
JavaScript, Usability | Permalink
3 December 2005
As it says. Useful overview of the tasks that we want to standardise.
JavaScript | Permalink
For once I disagree with Jeremy: the innerHTML property is a beautiful invention that makes DOM scripting much simpler, and I don't have the slightest compunction about using it. I hope Jeremy will work out his "issues", because innerHTML is just too good to ignore.
DOM | Permalink
An advent calendar with a web development tip for every day.
Accessibility, CSS, HTML, JavaScript | Permalink
30 November 2005
May be interesting after all, though I'll still have to study this library in detail.
Libraries, Reference | Permalink
29 November 2005
Always useful: a function that inserts text into a textarea at the current cursor position.
JavaScript | Permalink
28 November 2005
Contains a few browser bugs that don't seem to be covered anywhere else.
Data Retrieval | Permalink
24 November 2005
A list of JavaScript libraries. Does anyone else feel we've got too many libraries and not enough developers?
JavaScript, Linkdumps | Permalink
17 November 2005
Jeremy explains the problems of using framework libraries. I fully agree.
JavaScript | Permalink
11 November 2005
Brendan Eich reveals a few more interesting design principles for JavaScript 2.0 . As long as it's backward compatible I don't mind, though I don't see an immediate practical value for everyday scripting, either.
Core | Permalink
18 October 2005
Detailed investigation of the order of events in all browsers when you click on an input and/or a label. Excellent research.
Events | Permalink
Jeremy Keith takes a stab at dispelling the myth that the myth of JavaScript degradation can be dispelled. If your Ajax application does not degrade and is inaccessible, you made the wrong choices during the design phase. Simple as that. ANY application can become accessible, although I admit there's quite a lot of work to be done in defining best practices.
JavaScript, Theory | Permalink
An interesting, and especially SHORT script for adding rounded corners to an element of your choice. It begins to look as if JavaScript is the best alternative for this task, since it doesn't require you to insert tag soup into your XHTML just to provide for the corners.
DOM | Permalink
17 October 2005
11 October 2005
Over on Digital Web Jeremy explains once more what has gone wrong with the way JavaScript was used (DHTML!) and how we can clear up the situation.
History, JavaScript, Theory | Permalink
7 October 2005
I just discovered this useful Mozilla sidebar that lists all HTML, CSS and JavaScript elements, declarations and methods. The CSS part contains links to my CSS pages for further information on a few properties.
CSS, HTML, JavaScript, Tools | Permalink
5 October 2005
Example of the use of canvas. Firefox 1.5 or Safari 1.3 required.
JavaScript | Permalink
30 September 2005
Stuart Langridge explains a Mozilla event that fires when you scroll with the mouse wheel. It's a bit silly to use a separate event when the scroll event is also there, but it's useful to know that you can actually detect the mouse wheel in Mozilla.
Events, Mozilla | Permalink
Scott Andrew encounters the ghost of Netscape 4 and tries to squeeze it into Firefox.
JavaScript, Mozilla | Permalink
Bobby van der Sluis discusses various ways of adding CSS to hide elements only when JavaScript is supported. Includes a discussion of XHTML pages where the use of document.write() is not possible.
CSS modification | Permalink
25 September 2005
The other solution to the window.onload problem: HTCs.
onload | Permalink
24 September 2005
The load event fires when the entire page, including images, has been loaded. If clueless users upload 5M bitmaps to their sites, the event may fire far too late and the user may see all kinds of odd things happening while he's already doing something on the page.
What we need is a load event that fires when the document structure is complete, but that does not wait for the images. Dean Edwards provides. IE and Moz only, but it's a nice start.
onload | Permalink
22 September 2005
Opera introduces Browser JavaScript, bits of script that seem to rewrite the scripts on pages that don't work properly in Opera. 90 % of the examples is about changing browser detects.
Is this a good idea? It'll help Opera users in the short run, certainly, but what if it changes scripts wrongly? I'd love to take a peek under the hood to make sure that everything works fine.
JavaScript, Opera | Permalink
21 September 2005
By Aaron Gustafson on ALA. May be a useful script. I especially like the way Aaron first builds his scripts with comments: 'do this, then that, then that'.
JavaScript | Permalink
15 September 2005
Useful set of slides (using, of course, S5) about the basics of unobtrusive JavaScript.
JavaScript, Theory | Permalink
9 September 2005
Jep Castelein gives a useful overview of latency problems in AJAX: how and when should you download data? Preload it? Load it only when the user requests it? Small chunks? Large chunks?
Data Retrieval, Linkdumps | Permalink
5 September 2005
Problems with the this keyword in xmlhttp's readystatechange event. Turns out that Explorer considers it the window, Mozilla the event handler, and Opera the xmlhttp object.
Interesting bit of lore.
Data Retrieval | Permalink
30 August 2005
Eric Meyer discovered that the use of a few ID values that have special meaning in the old document.all DOM may cause IE to crash.
DOM | Permalink
29 August 2005
Useful overview of the problem with the load event handler and possible solutions, including their drawbacks.
onload | Permalink
27 August 2005
A sneak peek into Jeremy's upcoming book. This chapter explains why JavaScript has such a bad name, and what we can do about it. Needless to say, I completely agree.
JavaScript | Permalink
Scott Andrew discovered that Firefox does support document.all
, which it's supposed to ignore. So Firefox now executes supposedly IE-only code branches.
Annoying, but since we haven't needed document.all
at all since IE 4 went down, it shouldn't be too big a problem for standards aware JavaScript sites.
DOM, Mozilla | Permalink
1 August 2005
Some tests for determining JavaScript execution speed. Please do the tests; the results are automatically added to the database.
Benchmarks, JavaScript | Permalink
A reaction from the Safari team to my benchmark test of the same name. Although my conclusion seems not to have been correct, the test case allowed the Safari programmers to solve a bug in their getElementsByTagName implementation.
CSS modification, Safari, Tests | Permalink
31 July 2005
Dave (can't find his last name) continues his series of JavaScript benchmark tests, this time for finding the fastest method of changing the background colour of a table. The results are interesting, but I wish he'd publish his test pages.
Benchmarks, JavaScript | Permalink
29 July 2005
Great test page on the working of events in screen readers. If you happen to have an assistive device available, or know someone who does, please do the test! We badly need to know how screen readers actually handle JavaScript.
Accessibility, JavaScript, Screen readers, Tests | Permalink
28 July 2005
Useful overview of basic best practices. Needs to be expanded enormously, but it's good that someone is making a start.
Data Retrieval | Permalink
26 July 2005
A subject that interests me highly. I recently considered a sidenote system like the one presented here, but with one slight difference. Maybe I'm still going to write that article, but I first have to study the examples mentioned here.
CSS, JavaScript, Usability | Permalink
David Flanagan worries about possible conflicting namespaces when pages load a large number of scripts. He tries to create a list of requirements for a JavaScript module system, and asks for feedback. I myself have nothing to offer, since I know too little about namespaces, but maybe some of my readers will be able to help.
Core | Permalink
22 July 2005
Some reasons why AJAX is more popular than DHTML was back in the nineties. Also a few caveats that apply when working with AJAX applications.
Data Retrieval | Permalink
20 July 2005
An interesting function that allows you to set breakpoints in your JavaScript code. When a breakpoint is encountered, you can read out the values of your variables, which can be quite handy when you encounter a bug you can't solve with pure alerts. The script is one of the few practical examples of the use of closures.
Core | Permalink
Unobtrusive script that writes the HTML for a Flash movie into your pages if the user supports the correct Flash version. This allows you to use a nice placeholder message for noflash users, and to keep your pages valid since you don't need EMBED tags and such.
JavaScript | Permalink
19 July 2005
MS tips for faster DOM Scripting in Explorer. Contains benchmark tests (I thought I was the only one who did that). The tests could use a bit longer loops (1000 iterations instead of the 100 currently used), but all in all the tips have an experimental basis and can serve as a first step towards real benchmarking.
Benchmarks, DOM, IE | Permalink
18 July 2005
Isofarro adds to the list of blog entries about Saturday 11 June, when the JavaScript revolution began.
@media 2005, JavaScript | Permalink
14 July 2005
Erik Arvidsson proposes a few additions to JavaScript 1.6 . I largely have no opinion on these subjects, because I know too little about Core functionality, and avoid dates whenever I can. I'll leave it to wiser minds than myself to decide on these matters.
Core | Permalink
Excellent introduction to using XMLHTTPRequest by Cameron Adams.
Data Retrieval | Permalink
Eric Meyer has created an AJAX application that projects the effects of a nuclear strike on a Google Map. It uses Google Maps and some extra data Meyer created. This combining of data from different sources is going to be very important.
JavaScript | Permalink
A candidate AJAX best practice. I'd go for a simplified option 2: remember the node the data should be appended to and append it even when the user has clicked elsewhere.
Data Retrieval | Permalink
12 July 2005
Simple and to the point. I never thought of the target || srcElement trick. Worth remembering.
Core | Permalink
11 July 2005
Dedicated to providing solid information, documentation, and community for Mozilla and Firefox developers. Looks like an interesting initiative, and as far as I can see now the JavaScript and DOM pages might eventually take the place of the alas disappeared devedge JavaScript reference.
CSS, HTML, JavaScript, Mozilla, Reference | Permalink
10 July 2005
Benchmarking test for XSLT and JavaScript. Conclusion: Explorer Windows is far faster than Firefox. In Firefox JavaScript is much faster than XSLT.
Benchmarks, JavaScript | Permalink
A test suite by Gez Lemon that checks what browsers do right/wrong when you send XHTML pages as text/html or as application/xml+xhtml . Could use a formal compatibility table, but otherwise the tests are quite interesting.
CSS, HTML, JavaScript, Tests | Permalink
Interesting series of compatibility tables for HTML, CSS and JavaScript in Explorer Windows, Mozilla and Opera. I think my W3C DOM Tables are more useful and detailed, but the tables here are definitely more complete.
CSS, HTML, JavaScript, Reference | Permalink
7 July 2005
This tool might be useful. Run it, mouse over an element and see information. Only drawback: it doesn't work on generated elements. Turn off and then on to solve this problem.
DOM, Tools | Permalink
Must-read about the usability of AJAX applications.
Data Retrieval, Usability | Permalink
6 July 2005
Tarquin gives some useful tips about writing efficient scripts. His discussion of for-loops and the errors people make when writing them are especially interesting.
Core | Permalink
Derek Featherstone explains why screen reader users might have to turn off JavaScript.
@media 2005, Accessibility, JavaScript, Screen readers | Permalink
This is the linklog of Peter-Paul Koch, mobile platform strategist, consultant, and trainer. You can also visit his QuirksBlog, or you can follow him on Twitter.
Category rchives:
Monthlies: