Navigate to Fragment - issue #1716

Manual test to check each link goes to the right place.

Fragment Identifier | Intended Fragment | Test Target | Description
#top | Document | test0 | Top of document
#Top | <p id="Top"> | test8 | Id takes precendence over "top"
#sanity-check | <p id="sanity-check"> | test1 | Sanity check
#has%20space | <p id="has space"> | test2 | Contains a space
#escaped%20space | <p id="escaped%20space"> |  | Contains an escaped space. Only decoded fragid is used for ids.
#escaped%20unescaped%20collide | <p id="escaped unescaped collide"> | test4 | Another element has the same id but pecent-encoded. The decoded one should win.
#name-match | <a name="name-match"> | test5 |
#name-collide | <a id="name-collide"> | test6 | Same id as an anchor name. Id should win.
#escaped%20name | <a name="escaped%20name"> | test7 | Undecoded fragid should be used for anchor names.

span id="sanity-check"

SUCCESS test1

span id="has space"

SUCCESS test2

span id="escaped%20space"

FAIL test3

Not in whatwg spec, but a tolerant implementation would do this to give content creator what they probably intended.

span id="escaped unescaped collide"

SUCCESS test4

span id="escaped%20unescaped%20collide"

FAIL test4

Not in whatwg spec, but a tolerant implementation would do this to give content creator what they probably intended.
a name="name-match"

SUCCESS test5

a name="name-collide"

FAIL test6

An anchor name and an id have the same value. The id should take precence!
a id="name-collide"

SUCCESS test6

a name="escaped%20name"

SUCCESS test7

p id="Top"

SUCCESS test8