From the selectors specification:
Attribute values must be CSS identifiers or strings.
Identifiers cannot start with a number. Strings must be quoted.
1 is therefore neither a valid identifier nor a string.
Use "1" (which is a string) instead.
var a = document.querySelector('a[data-a="1"]');