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

handling click events on :before/:after pseudo-elements

From: David Karger <karger@mit.edu>
Date: Tue, 06 Nov 2012 14:31:36 -0500
Message-ID: <50996598.1070701@mit.edu>
To: www-style@w3.org
I've run into an under-specification in css that has apparently led 
firefox and chrome to choose different behaviors; either is fine, but it 
would be nice if the css specification were extended to encourage 
consistency.

The question is: if I declare some content to be inserted via the 
:before or :after pseudo elements, how should the event model handle 
clicks *on* the inserted content?  In firefox, clicking on the 
pseudo-content triggers a click event on the element that has been 
styled with the pseudo content; in chrome, it does not (the click falls 
through to whatever element is "behind" the pseudo content).

Formally, given

p:before
{
content:"Click here"
}

does clicking on "Click here" trigger a click event on the paragraph 
being styled?

I would personally consider the firefox approach more appropriate, but 
would be happiest with any consistent outcome.
Received on Tuesday, 6 November 2012 19:32:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT