Normalize hook default Web behaviour
Ian Hickson
ian at hixie.ch
Fri Aug 15 10:43:16 PDT 2014
Hello again,
I'm looking at what the default behaviour of the Web's normalize hook
should be. I've read through the links people have posted about this
before, e.g. [1], but they tend to focus on the behaviour for sensible
inputs and ES6-only inputs, so I'm not sure the following cases are
really covered by those.
The first case is around normalization vs location. Suppose a page has
this markup:
<base href="http://example.com/">
<script type=module href="http://example.com/foo.js"></script>
<script type=module> import "foo"; </script>
Do we want foo.js to be downloaded and executed once, or twice?
Second case:
import "test/";
What should that do:
throw in the normalize hook?
import the file at "http://example.com/test.js"?
import the file at "http://example.com/test/.js"?
import the file at "http://example.com/test/default.js"?
Third case: empty string. What should get imported, if anything, if you
do something like this?:
import "";
Fourth case: Suppose the referrer name is "foo/bar", the base URL is
"http://example.com/baz/", and a module tries to import "../../../quux".
What should get imported?
"http://example.com/baz/quux.js", because you only apply the "../"
resolution to the referrer name, and trim leading "../"s.
"http://example.com/quux.js", because you apply the "../"
resolution to the referrer name and the base URL, and trim leading "../"s.
nothing, throw an exception because the ".."s go beyond the referrer
name's root.
nothing, throw an exception because the ".."s go beyond the domain root
when normalised.
[1] https://github.com/dherman/web-modules/blob/master/browser-loader/requirements.md
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the es-discuss
mailing list