Elsewhere on the 'Net - DOM
DOM elsewhere on the 'Net.
Part of JavaScript.
4 May 2009
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
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
20 October 2007
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
10 June 2007
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
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
9 May 2007
Finally a good summary of accessing a document inside an iframe.
DOM
| 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
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
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
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
6 February 2006
A little DOM tutorial for innerHTML junkies. Interesting approach.
DOM
| Permalink
3 December 2005
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
18 October 2005
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
Two interesting innerHTML tidbits.
DOM
| 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
27 August 2005
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
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
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