Update mocha dependency to 1.17.x.
Fix CSS [lang], [dir], etc selectors.

Be more careful when testing for the presence of an attribute which is
also a 'magic' property of HTMLElement; use Element.getAttribute() to
avoid being confused by the default value.  For other attributes, make
use we use Element.hasAttribute() when possible to avoid getting
confused by methods and other properties on the element.