Closed
Bug 784405
Opened 12 years ago
Closed 12 years ago
firefox accepts invalid url() for at least background-image
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: cobexer, Unassigned)
Details
Attachments
(1 file)
978 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 2012071300
Steps to reproduce:
<!doctype html>
<html>
<head>
</head>
<body>
<div id="test">
<h2>background should be green</h2>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var green = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgaGD4DwAChAGA2FJdiQAAAABJRU5ErkJggg==';
var red = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4z8DwHwAFAAH/q842iQAAAABJRU5ErkJggg==';
$(function() {
var $t = $("#test");
$t.css('background-image', 'url("' + green + '")');
$t.css('background-image', 'url("' + red + '"'); // ) is missing
})
</script>
</body>
</html>
Actual results:
the second invalid attempt to set the background image is accepted too (IE9 and Chrome 21 both reject it)
Expected results:
background green
should have thrown syntax error ? (not sure i would want that tough)
Attachment #653837 -
Attachment mime type: text/plain → text/html
![]() |
||
Comment 2•12 years ago
|
||
The spec requires this behavior. Yes, IE and Chrome get it wrong.
Specifically, see http://www.w3.org/TR/CSS21/syndata.html#parsing-errors under "Unexpected end of style sheet".
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
![]() |
||
Comment 3•12 years ago
|
||
And note that you don't even need the dynamic stuff. Just doing:
<style>
body { background-image: url("something.png"</style>
will trigger the relevant error-handling codepath in UAs that implement the spec properly.
You need to log in
before you can comment on or make changes to this bug.
Description
•