Use null to accurately check hasAttribute.