Bug 51172

Summary: Implement @-webkit-document CSS rule for use in user stylesheets
Product: WebKit Reporter: Mathias Bynens <mathias>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: ap, hyatt, jason.barnabe, kenwfoyjr, mathias, mitz, mkterra, peter, pf, ronan, syoichi, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: https://developer.mozilla.org/en/CSS/@-moz-document

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/),  
  /* 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 
  /* 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:

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. ***