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 8624 - Possibility not to provide a URL to validate CSS content using parseStyleElement
Summary: Possibility not to provide a URL to validate CSS content using parseStyleElement
Status: NEW
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: Parser (show other bugs)
Version: CSS Validator
Hardware: PC Linux
: P2 enhancement
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-04 11:47 UTC by fd
Modified: 2010-01-04 11:47 UTC (History)
0 users

See Also:


Attachments

Description fd 2010-01-04 11:47:58 UTC
Description
------
There may be cases when the URL of the CSS content that is to be validated is unknown or when it cannot be "retrieved", e.g. because the CSS content is the result of a copy and paste (typically the case when a direct input method is available) or because it uses a URI scheme that Java is unaware of.

org.w3c.css.css.StyleSheetParser.StyleSheetParser#parseStyleElement expects a URL to be always provided as a parameter. It uses that URL as the base URI to resolve @import rules that may appear in the CSS content and further retrieve additional content.

The only way to validate CSS content that got extracted from a non-URL source is to provide the method with a fake URL of the form "file://example.org". The code does not report any error when a "file" URL is used because it is used internally to represent "direct input" CSS content.

That is a bit awkward, in particular because the "file" scheme should not be treated in any specific way by the CSS validator. It is perfectly valid to use it to identify and locate an HTML page and/or CSS content on the Web.


Suggested functionality
-----
There should be a way to validate CSS content without having to provide a URL. The CSS validator may return a warning when it encounters URLs in the CSS content that it cannot resolve in that case.

Alternatively, if the CSS validator needs an identifier to be provided, consider accepting a URI instead of a URL, as URIs do not need to be "retrievable". The CSS validator could still attempt to convert the URI to a URL to resolve imports and report a warning when that cannot be done.