I’m working on putting some band-aid fixes into an application supplied to work by an outside vendor. For various reasons, I can’t say who, which I really think is a shame, but…
Anyway, one of the problems with this web app is that it is highly stateful. It can’t handle people doing double-clicks of links and so forth (as in the app breaks if they do). So, to band-aid that, we want to have the links disable themselves after clicking.
Quoting from the MSDN description of the disabled property:
When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property.
I guess I shouldn’t complain too much; according to the W3C’s DOM spec and the HTML 4.0 spec, anchors shouldn’t even support the disabled property; this is a Microsoftism. However, seeing as how it does, it should at least support it properly.
What makes it even sillier, however, is that if the anchor tag is disabled, I can click on it and the onClick event fires, so I can trap it (and cancel it). However, if I disable the entire body tag (thus disabling the whole page), I can still click on the link, but the onClick event for the tag won’t fire… the browser just goes to the target page. Go figure.
This wasted a good 2 hours of my time this afternoon, largely because I couldn’t get over how silly this was. Tomorrow, I’ll just move on, I think…