Fix querying detached nodes and document fragments by id

This PR should fix [issue #17699](https://bugs.dojotoolkit.org/ticket/17699).
Fair enough.  Still, maybe it should try a fallback?  eg. first try byId on ownerDocument (if not null), then if that fails try it with just root, and only if that fails fall back to manually searching for it.