Open quoll opened 9 months ago
It doesn't appear to be possible to construct a native URL
ending in '#'
without setting the initial string to have one.
Setting URL.hash
to the empty string results in no ending #
.
In addition, new URL('http://example.com/test#').hash === new URL('http://example.com/test').hash
returns true
.
Using native APIs (barring toString
), is there a way to distinguish window.location
with and without the fragment token?
When the fragment portion of a URI is an empty string, then this is not distinguished from an undefined fragment.
Consequently, an empty fragment (a common construct in Semantic Web applications) is not preserved. For instance, the following returns true:
This goes against RFC 3986, 5.3 Component Recomposition, which states:
In general, it would be simple to record a
null
or empty string on line 154, but the compatibility note points out that this may not work in IE.