Re: Hit-testing on the body element

On 8/1/14, 8:46 AM, Robert Hogan wrote:
> In the test case below, Blink and WebKit display a red background on the
> body element when the mouse hovers over the page.
>
>   <style>
>       body:hover { background-color: red; }
>   </style>
>   <body></body>
>
> FF/IE/Presto do not display a red background. None of them set
> pointer-events:none on the body element, so I'm guessing each
> implementation special-cases the body element some other way.

Other way around.  Blink and WebKit special-case <body> in quirks mode 
so that it's at least the same height as the viewport.

In standards mode, behavior on that testcase is identical in all 
browsers: the body is height 0, so you can't hover it.

I suggest putting a border on your body to see what its box looks like 
when testing things related to it.  Or putting a background on the body 
_and_ the <html> element, of course.

> Is this behaviour specified anywhere

The standards mode behavior is specified in the CSS spec.

The quirks mode behavior of Blink/WebKit is just a bug they should fix, 
imo; it's clear that the web does not depend on it.

-Boris

Received on Friday, 1 August 2014 14:22:05 UTC