Skip to content

24 ways to impress your friends

Vote up?

Scott Sauyet

Instead of getting the text by using labels(i).childNodes(0).nodeValue and parsing the string, why not use the title attribute of the label element, which “offers advisory information about the element for which it is set.” (WC3 Recommendation).

It seems the perfect fit, not only semantically correct, but

format = labels(i).title;

is certainly a less brittle implementation than

var format = labels(i).childNodes(0).nodeValue;

var startpoint = format.indexOf("(format ")+ 8;

var endpoint = format.indexOf(")");


Does this make sense?

—Scott, who does know that those are supposed to be square brackets, but Textile isn’t playing nicely with source code…