[whatwg] Allowing custom attributes on <html> or <body> in documents for media resources

Ian Hickson ian at hixie.ch
Mon Jan 30 14:10:28 PST 2012

On Thu, 10 Nov 2011, Robert O'Callahan wrote:
> http://www.whatwg.org/specs/web-apps/current-work/#read-media
> Can we allow the UA to add custom vendor-prefixed attributes to the 
> <html> and/or <body> elements? Alternatively, a vendor-prefixed class? 
> We want to be able to use a style sheet with rules matching custom 
> attributes to indicate various situations (e.g., whether the document is 
> a toplevel browsing context) to set the viewport background.

On Tue, 15 Nov 2011, Tab Atkins Jr. wrote:
> While I'd normally object that classes are purely an author extension 
> point and UAs should stay out, this is a UA-generated page in the first 
> place so it's not a big deal.
> I might suggest using a pseudoclass instead, though, as that's the 
> normal UA extension point.  Is there any particular reason to prefer a 
> class over a pseudoclass?

On Wed, 16 Nov 2011, Robert O'Callahan wrote:
> It's a little bit more code to implement a pseudoclass, at least in 
> Gecko. (It's literally one line to add a custom class or attribute; the 
> situation is probably similar in other engines.)
> If a custom attribute seems better to you, that's just as easy as a 
> class.

On Tue, 15 Nov 2011, Tab Atkins Jr. wrote:
> I'm slightly happier with a custom attribute, yeah, just from a purity 
> standpoint.  It's equivalent otherwise.

On Wed, 16 Nov 2011, Robert O'Callahan wrote:
> Very well then, I propose that a "toplevel" attribute be added to the 
> root element of media resource documents in toplevel browsing contexts 
> :-).

Is there any reason you can't just put whatever styles you want into a 
<style> element? It's not clear to me why you need to reference a global 
style sheet rather than referencing or generating a style sheet 
specifically for each case.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list