Partially revert commit a64dc0405064d68c7b7cd0f0fc8ea60086cbcd21.
Removing the conditional was too liberal as now attr() would even work
on plain javascript objects. Keeping a check to make sure it is at least
a DOM Node is appropriate. Using nodeName as in the commit which introduced
the nodeType === 1 check seems plausible.