W3C home > Mailing lists > Public > www-style@w3.org > November 2008

Re: [css3-selectors] Elements that can have :focus pseudo-class

From: Brad Kemper <brkemper.comcast@gmail.com>
Date: Sun, 16 Nov 2008 12:25:34 -0800
Cc: www-style@w3.org
Message-Id: <98716708-AEB7-48CA-842C-D485810ED793@gmail.com>
To: L. David Baron <dbaron@dbaron.org>


On Nov 16, 2008, at 11:30 AM, L. David Baron wrote:

> On Sunday 2008-11-16 11:03 -0800, Brad Kemper wrote:
>> For instance, consider the following CSS and body tag:
>>
>> <head>
>> 	<style type="text/css">
>> 		body { background-color:red; }
>> 		body.focus { background-color:green; }
>> 	</style>
>> </head>
>> <body onfocus="document.body.className='focus';"
>> onblur="document.body.className='';" class="focus">
>>
>> With this, the background-color of the body will turn green when it
>> comes into focus, and turn red when another window or frame gains  
>> focus.
>> And when it has focus, it will not lose it do to something else in  
>> the
>> same window (including a link, but not including an iframe) gains  
>> focus.
>
> But in this case it's not actually the body that has the focus.
> Depending on the browser, it's either the document or the window.
> However, there's a convention of using some event handling
> attributes on the body for events that are targetted at the Document
> or the Window.

Ah yes. And the reason for that convention? Because there is no WINDOW  
element in HTML? Just as there is no WINDOW element in CSS. So it is  
really a similar problem, but one that is not solved for CSS. I would  
like us to us that same convention when we deal with events (such as  
focus).
Received on Sunday, 16 November 2008 20:26:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:17 GMT