This may not be important, but this misses the case where `node` is a ShadowRoot.