JavaScript URI functions – unit tests

This HTML document invokes a set of unit tests for JavaScript functions that resolve URI references to absolute form.


Important note:

These tests expect the "wrong" results when merging a relative path with a base URI consisting of just a scheme and a relative path (no leading "/"). The tests affected are 2, 6, 7, and maybe 162.

The expected results are incorrect according to RFC 3986/STD 66, but are actually better than what the algorithm in the spec produces. When RFC 3986/STD 66 was in development, Graham Klyne reported this issue and suggested that the resolution algorithm be adjusted to provide a more reasonable result. There was no argument, so I made my absoluteizeURI() function and these unit tests with the expectation that the final draft of the URI spec would contain a fix for the issue. However, when RFC 3986 was finally published, there was no change to the resolution algorithm.

I finally got around to mentioning this on the URI WG list in Oct. 2012, in response to a post which indicated that there are more JavaScript libraries out there which I could add to this test harness. However, nothing was ever done about it.