-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.
Description
Version
v18.7.0 v16.16.0
Platform
alpinelinux and archlinux
Subsystem
No response
What steps will reproduce the bug?
Node
> new URL("sindre://www.sorhus.com").protocol
'sindre:'
> new URL("sindre://www.sorhus.com").host
'www.sorhus.com'
> new URL("sindre://www.sorhus.com").pathname
''
Google Chrome 92
> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"
Mozilla Firefox 90
> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
> new URL("sindre://www.sorhus.com").host
'www.sorhus.com'
> new URL("sindre://www.sorhus.com").pathname
''
Additional information
Related background story issue
sindresorhus/normalize-url#140
sindresorhus/normalize-url#147
Related background story
To answer Can I use version 7 in the browser?
I fork sindresorhus/normalize-url to loynoir/normalize-url
In that fork, I added real browser test using karma.
And found browser falling case, but it's ok in node
t.is(normalizeUrl('sindre://www.sorhus.com'), 'sindre://sorhus.com');
Seems root cause is
Node
> new URL("sindre://www.sorhus.com").protocol
'sindre:'
> new URL("sindre://www.sorhus.com").host
'www.sorhus.com'
> new URL("sindre://www.sorhus.com").pathname
''
Google Chrome 92
> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"
Mozilla Firefox 90
> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"
Metadata
Metadata
Assignees
Labels
whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.