Closed Bug 1312700 Opened 10 years ago Closed 10 years ago

Imposible to use hash ("#") in quoted data uri

Categories

(Core :: Networking, defect)

49 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 826562

People

(Reporter: rulumasi, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36 Steps to reproduce: Demo. Working example: <html> <head> <meta charset="utf-8" /> <style> .custom_marker { list-style-image : url( " \ data:image/svg+xml; \ charset=UTF-8, \ <svg \ xmlns='http://www.w3.org/2000/svg' \ xmlns:xlink='http://www.w3.org/1999/xlink' \ width='1ex' \ height='1ex' \ viewBox='-5 -5 10 10' \ > \ <defs> \ <circle \ id='id1' \ r='5' \ fill='yellow' \ stroke='red' \ /> \ </defs> \ <use \ xlink:href='%23id1' \ /> \ </svg> \ " ); } </style> </head> <body> <ul class="custom_marker" > <li> 1 </li> <li> 2 </li> <li> 3 </li> </ul> </body> </html> Note that in line 27 string "%23" used instead of hash ("#"). Actual results: If use hash ("#") in line 27 instead of string "%23", firefox will not display custom list marker. Google chrome will display custom list marker in both cases. Expected results: Correctly process data uri in both cases: * with string "%23"; * with hash character ("#") as like Google chrome does.
maybe by design(bug 658949)
Blocks: 658949
Component: Untriaged → Networking
Product: Firefox → Core
:dholbert - you wrote the patch in bug 658949, can you comment on the intentionality of this behavior?
Flags: needinfo?(dholbert)
Our behavior here is what the spec (the URI RFC, as I recall) requires. Chrome is non-conforming (and has odd behavior on other demos as a result). Basically: in Firefox, the hash character (correctly) terminates the URI and begins the anchor identifier, just like in any other URI. If you want there to be an actual hash character in your data-URI-encoded document, then %23 is the correct way to specify it. (Roc & I suggested some possible changes to the spec on whatwg a while ago, to make this more friendly: https://lists.w3.org/Archives/Public/public-whatwg-archive/2011Sep/0100.html but we got pushback & folks arguing that our behavior is correct, so we haven't changed.)
Flags: needinfo?(dholbert)
So, this is basically a dupe of bug 826562 (which is INVALID since we're following the spec).
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Can this bug be reconsidered for web compatibility? It seems all other major browsers support unescaped # in a data uri, except Firefox. While it may be spec-conforming to require escaping, there are lazy developers out that don't test in Firefox which can break sites. Example fiddle: https://jsfiddle.net/c0ak9pq1/16/ Popular StackOverflow issue: https://stackoverflow.com/q/30733607
I replied to the copy of comment 5 that you posted, over in bug 826562 comment 14. (For future reference: please don't try to start the same parallel conversation on multiple different instances of the same bug. Really, it's best to avoid commenting on closed-as-duplicate bugs at all, because it makes it hard to follow discussions; instead, comments should go on the duplicate target, which in this case is bug 826562.)
(Yes, sorry about that. I found this bug while searching, but only noticed later that bug 826562 was better suited for discussion)
You need to log in before you can comment on or make changes to this bug.