W3C home > Mailing lists > Public > www-style@w3.org > August 2014

Re: Hit-testing on the body element

From: Emerson Veenstra <emerson@emersonveenstra.net>
Date: Fri, 1 Aug 2014 10:01:35 -0400
Message-ID: <CAKmveHqwnVd1Mn7f7btB2hJpg5R67mQ6zWdKzLjS+KR=_OtOwA@mail.gmail.com>
To: Robert Hogan <robhogan@gmail.com>
Cc: www-style list <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
On Fri, Aug 1, 2014 at 9:41 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

>
> On Aug 1, 2014 7:49 AM, "Robert Hogan" <robhogan@gmail.com> 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.
> >
> > Is this behaviour specified anywhere or is it just common-sense? Would
> using pointer-events:none in html.css be a better way of enforcing it?
>
> Did you intend for that to have no doctype, and thus be in quirks mode?
>
> ~TJ
>

I can confirm that this does work in the latest versions of Gecko,
Webkit/Blink, and Presto, as well as IE10. Here is the testcase I used:
http://files.emersonveenstra.net/testcases/bodyhover.html.
Your results may also have been because you didn't specify a height on the
body, and because it is empty, it will have a height of 0

HTH,

--Emerson
Received on Friday, 1 August 2014 14:02:26 UTC

This archive was generated by hypermail 2.3.1 : Friday, 1 August 2014 14:02:27 UTC