This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12384 - Validator rejects a link href with an ampersand in the query string
Summary: Validator rejects a link href with an ampersand in the query string
Status: REOPENED
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-27 11:38 UTC by Rob Fletcher
Modified: 2015-08-23 07:42 UTC (History)
4 users (show)

See Also:


Attachments

Description Rob Fletcher 2011-03-27 11:38:54 UTC
If a document has a link element in the head with a query string the validator will reject it if the query string contains '&'. For example:

<link rel="stylesheet" type="text/css" href="/css/main.css?_debugResources=y&n=1301223807152">

When I validate a document containing this I get: "& did not start a character reference. (& probably should have been escaped as &amp;.)"
Comment 1 Etienne Miret 2011-08-23 18:28:45 UTC
This is the correct behavior. Literal '&' must be escaped as '&amp;' EVEN INSIDE URLS.
Comment 2 Jukka K. Korpela 2014-06-23 12:48:19 UTC
In HTML5, when HTML syntax is used, the construct is valid, because the syntax rules forbid only “ambiguous ampersands”:
http://www.w3.org/TR/html5/syntax.html#attributes-0

The ampersand is not ambiguous in this case, or in other common cases where a query part of a URL contains fields separated by ampersands. An “ambiguous ampersand” is by definition “a U+0026 AMPERSAND character (&) that is followed by one or more alphanumeric ASCII characters, followed by a ";" (U+003B) character, where these characters do not match any of the names given in the named character references section”. There is no semicolon here.
Comment 3 Michael[tm] Smith 2015-08-23 07:42:10 UTC
known issue