Thursday, November 13, 2008

Javascript tagName and labels

First of all, tagNames are always UPPERCASE! Secondly, when an event listener (onclick) is registered to an element, containing a label with its 'for' attribute set to a valid input id, click on that label will result in two events being fired: one for the label and one for the appropriate input.

Tuesday, November 4, 2008

Are you using getters and setters?

Then use them everywhere. I mean equals, toString, compare and other methods, belonging to the same class. Failing to do so might backfire any time you add some logic to the setter/getter (and I know, that getters/setters are considered an anti-pattern by some, but that's another topic).