moz-behaviors.xml has had a small update. In previous versions I was honouring an Internet Explorer bug that meant updating a DOM property also updated the corresponding attribute. This is a subtle bug and requires some explanation.
Consider the following code snippet:
document.body.foo = "bar"; alert(document.body.getAttribute("foo"));
In standards compliant browsers the alert box will show “null”. Internet Explorer shows “bar”. The reason for this behaviour is that IE makes no distinction between DOM properties and attributes. This is illustrated even more clearly by the following code:
document.body.setAttribute("class", "foo") alert(document.body.className);
There is a school of thought that says the IE behaviour is more intuitive. I tend to agree. I can’t think of a good reason why DOM properties and attributes have been separated like this (the
className example is clearly a bug however).
So what does this have to do with beer? Well, nothing really. I just wanted to thank the good guys at Technical Pursuit for sending me some beer. They’ve been using moz-behaviors quite a lot and decided to thank me in a way they knew I’d appreciate. For the record, If anyone else wants to send me beer that is completely OK.