-
Notifications
You must be signed in to change notification settings - Fork 43
& not handled correctly inside urls #64
Copy link
Copy link
Open
Description
Consider
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
<p>Some text with an <a href="https://example.com/something&search=test">url</a></p>
<p>Some text with another <a href="https://example.com/something&search=test">url</a></p>
</body>
</html>
htmlmin index.html generates
<!DOCTYPE html><html lang=en> <head><meta charset=utf-8><title>Hello World</title></head> <body> <p>Some text with an <a href="https://example.com/something&search=test">url</a></p> <p>Some text with another <a href="https://example.com/something&search=test">url</a></p> <p>And other text with another <a href="https://example.com/something%26search=test">url</a></p> </body> </html>
Notice how the first url changed from https://example.com/something&search=test to https://example.com/something&search=test.
This is technically not correct, as the ampersand character declares the beginning of an entity reference.
Also the w3 guidelines suggest to use & instead of & in this context.
Validators like htacg/tidy-html5#1017 correctly complain about the invalid entity reference.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels