Bug 51172 - Implement @-webkit-document CSS rule for use in user stylesheets
Summary: Implement @-webkit-document CSS rule for use in user stylesheets
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: https://developer.mozilla.org/en/CSS/...
Keywords: InRadar
: 75456 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-16 02:35 PST by Mathias Bynens
Modified: 2022-07-12 14:05 PDT (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Bynens 2010-12-16 02:35:49 PST
Something similar to @-moz-document <https://developer.mozilla.org/en/CSS/@-moz-document> would make it *much* easier to write and use custom user stylesheets.

Also see <http://lists.w3.org/Archives/Public/www-style/2004Aug/0135>.
Comment 1 Alexey Proskuryakov 2010-12-16 12:04:00 PST
Pasting from the provided URL:

The @-moz-document rule is a Gecko-specific at-rule that restricts the style rules contained within it based on the URL of the document. It is designed primarily for user style sheets.

@-moz-document url(http://www.w3.org/),  
               url-prefix(http://www.w3.org/Style/),  
               domain(mozilla.org)  
{  
  /* CSS rules here apply to: 
     + The page "http://www.w3.org/". 
     + Any page whose URL begins with "http://www.w3.org/Style/" 
     + Any page whose URL's host is "mozilla.org" or ends with 
       ".mozilla.org" 
   */  
  
  /* make the above-mentioned pages really ugly */  
  body { color: purple; background: yellow; }  
}
Comment 2 mkterra 2010-12-16 15:13:50 PST
If at all possible, supporting @-moz-document itself would be vastly preferable.  That way, existing styles will work without users having to wait for updates, and authors won't have to maintain two superficially-different versions for Gecko and Webkit.
Comment 3 Peter Beverloo 2010-12-17 00:39:27 PST
They're called vendor prefixes for a reason. While it would indeed benefit convenience for using user-stylesheets, I'd consider it a bad thing to support another vendor's prefix.
Comment 4 Ronan Jouchet 2011-05-16 06:25:35 PDT
FYI, someone created a userscript that partially does the job:
http://code.google.com/p/chromium/issues/detail?id=2393#c63

This doesn't mean this bug is fixed, but it can be used as a workaround in the meantime.
Comment 5 Mathias Bynens 2011-09-06 11:05:57 PDT
This is now included in the CSS Conditional Rules Module Level 3 draft: http://www.w3.org/TR/css3-conditional/#at-document
Comment 6 Alexey Proskuryakov 2012-01-02 23:15:09 PST
*** Bug 75456 has been marked as a duplicate of this bug. ***
Comment 7 Radar WebKit Bug Importer 2022-07-12 14:05:13 PDT
<rdar://problem/96909164>