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

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  

Received on Sunday, 16 November 2008 20:26:13 UTC