Closed Bug 521421 Opened 15 years ago Closed 14 years ago

CSS interprets relative URI incorrectly by using containing page rather than css file as root

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jwdavidson, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

Ref: http://www.w3.org/TR/CSS21/syndata.html#uri

 In order to create modular style sheets that are not dependent on the absolute location of a resource, authors may use relative URIs. Relative URIs (as defined in [RFC3986]) are resolved to full URIs using a base URI. RFC 3986, section 5, defines the normative algorithm for this process. For CSS style sheets, the base URI is that of the style sheet, not that of the source document.

Example(s):

For example, suppose the following rule:


body { background: url("yellow") }

is located in a style sheet designated by the URI:

http://www.example.org/style/basic.css

The background of the source document's BODY will be tiled with whatever image is described by the resource designated by the URI

http://www.example.org/style/yellow

The above extract from the W3C documentation gives the correct behaviour, while Firefox treats a URI in the css file as being relative to the containing page, which is incorrect.

This is a significant problem with background-image url's

Reproducible: Always




IE 6, 7 & 8 all correctly interpret the relative URI in a css file according to the specification
This works fine on thousands (millions?) of Web sites.  If you have a page where it isn't, could you include the URL of that page and reopen?
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → style-system
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.