Ugh. Is there some way we could avoid this nastiness?

Also, we should use `Object.prototype.toString.call(dom) === '[object Object]'`, as the above will throw a TypeError if `dom` is null (since `typeof null` is `'object'`).