My code is:
p {
position: relative;
background-color: blue;
}
p:before {
content: \'\';
position: absolute;
left:100%;
width: 10px;
None of these answers are reliable, and mine wont be much more reliable.
Caveats aside, if you do get into the lucky scenario where the element you're trying to have clicked doesn't have padding (such that all of the "inner" space of the element is completely covered by sub-elements), then you can check the target of the click event against the container itself. If it matches, that means you've clicked a :before or :after element.
Obviously this would not be feasible with both types (before and after) however I have implemented it as a hack/speed fix and it is working very well, without a bunch of position checking, which may be inaccurate depending on about a million different factors.