Spec: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid:the-indicated-part-of-the-document-6
Test: http://w3c-test.org/html/browsers/browsing-the-web/scroll-to-fragid/
In the current specification, a rough algorithm to find "the indicated part of the document" for HTML documents is like:
- Search IDs for decoded fragid
- Search names for not-decoded fragid
However, it doesn't match to none of Chrome, Edge, Firefox, and Safari.
Chrome and Safari:
- Search IDs for not-decoded fragid
- Search names for not-decoded fragid
- Search IDs for decoded fragid
- Search names for decoded fragid
Firefox:
- Search IDs for decoded fragid
- Search decoded names for decoded fragid
Edge:
- Search IDs for decoded fragid
- Search names for decoded fragid
(Note that Edge has different behavior in http: and file:.)
I hesitate to make Google Chrome match to the specification because it would introduce yet another incompatible implementation.