Closed
Bug 331738
Opened 18 years ago
Closed 2 years ago
style.background returns empty URL if a background-image is specified as url('example.png' )
Categories
(Core :: DOM: CSS Object Model, defect, P5)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: gomita, Unassigned)
Details
(Keywords: css2, testcase)
Attachments
(2 files, 1 obsolete file)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Please note there is a white-space between ' and ). If a background-image of an element is specified as below; background-image: url('example.png' ); style.background property of the element returns an empty URL like 'url( )'. Reproducible: Always Steps to Reproduce: 1. Open the testcase page which contains the following HTML. --- <body style="background-image: url('http://www.example.com/icons/apache_pb2.gif' );" onload="alert(document.body.style.background);"> Actual Results: An alert says background is 'url( )'. Expected Results: An alert says background is 'url(http://www.example.com/icons/apache_pb2.gif)'.
Comment 1•17 years ago
|
||
The URL is "404: Not Found!". This bug has been fixed. I can upload a testcase based on the chunck of code in Description, if needed. Resolving as WORKSFORME
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
Sorry, I attached the testcase and I still get the same result which I got before.
Comment 4•17 years ago
|
||
The difference between my testcase and yours is the blank space after the single quote. Try your testcase with style="background-image: url('http://www.example.com/icons/apache_pb2.gif');" instead of style="background-image: url('http://www.example.com/icons/apache_pb2.gif' );" and you'll see that it works. The W3C CSS validator will not report an error for such blank space nor will the WDG CSSCheck service. So, it looks like you have a valid bug here. DOM inspector reports style="background-image: url( );" for the body element. Reopening
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Comment 6•17 years ago
|
||
The format of a URI value is 'url(' followed by optional whitespace followed by an optional single quote (') or double quote (") character followed by the URI itself, followed by an optional single quote (') or double quote (") character followed by optional whitespace followed by ')'. CSS 2.1, Section 4.3.4, URLs and URIs http://www.w3.org/TR/2006/WD-CSS21-20061106/syndata.html#value-def-uri and same thing with CSS 2.0 http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#uri So, according to CSS 2.x, it is perfectly correct, valid to have a whitespace between the ' and the ). Another testcase upcoming
Comment 7•17 years ago
|
||
Instructions: click each button Expected results: An alert should return url('http://www.mozilla.org/images/key-point_back.gif' ) or url('http://www.mozilla.org/images/feature-logos1.png' ) and not url( )
Comment 8•17 years ago
|
||
Corrected testcase (with utf-8 encoding) Instructions: click each button Expected results: An alert should return url('http://www.mozilla.org/images/key-point_back.gif' ) or url('http://www.mozilla.org/images/feature-logos1.png' ) and not url( )
Attachment #262402 -
Attachment is obsolete: true
Comment 9•17 years ago
|
||
Opera 9.20 and Safari 2.0.4 succeed in all 4 alerts; MSIE 7 succeeds in the last (involving querying style.backgroundImage) 2 alerts.
Comment 10•17 years ago
|
||
This bug may be more about parsing url('...' ) than about background-image. It would be revealing to test some node having cursor: url('...' ) as well. Hmm...
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
Comment 11•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 12•2 years ago
|
||
Works on my machine
Status: NEW → RESOLVED
Closed: 17 years ago → 2 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•