layered-apis icon indicating copy to clipboard operation
layered-apis copied to clipboard

Can we/should we make std:x | y work?

Open domenic opened this issue 7 years ago • 5 comments

@drufball wrote some example slides wherein he did

<script type="module"
        src="std:virtual-list | https://cdn.example.com/virtual-list.js">
</script>

Per the current spec, that won't work; it'll look for a layered API named "virtual-list " (which doesn't exist; note the space).

The space after the | is not a problem, as URL parsing strips ASCII whitespace.

Probably we should just insert a step to strip ASCII whitespace from the LAPI identifier?

/cc @hiroshige-g

domenic avatar May 04 '18 17:05 domenic

In #15 @hiroshige-g noted that using spaces in URLs is invalid. Even if we make | valid (#15), we won't make spaces valid, as that causes problems with places like srcset="". So this issue is about whether we should attempt to be a bit nicer to users who type invalid URLs.

I am undecided.

domenic avatar May 07 '18 22:05 domenic

Stripping trailing/leading whitespace around the "|" seems good to me. Putting those spaces in makes these URLs considerably more legible IMO. I guess a question is whether we should allow newlines. I think not?

ojanvafai avatar May 08 '18 01:05 ojanvafai

I don't feel strongly though if there are good coutnerarguments.

ojanvafai avatar May 08 '18 01:05 ojanvafai

I think we'd probably just use the standard strip ASCII whitespace algorithm which would allow newlines.

domenic avatar May 08 '18 01:05 domenic

I weakly prefer being strict and disallowing whitespace, at least initially. This seems like one of those things that can always be loosened up later. OTOH, if we allow whitespace now, we won't be able to go back.

mathiasbynens avatar Jun 15 '18 10:06 mathiasbynens