Switched code from using hasAttr followed by getAttr to simply call getAttr directly and check the resulting value.

No functional changes intended.