::selection is a CSS pseudo-class, not a jquery selector!
You cannot do this $('p::selection').css({color: "#3c3"}) and expect the text selection color to be changed.
$(<selector>) allows you to flexibly select dom elements using identifiers, css classes, attributes ...
:hover :after ... ::selection is a CSS pseudo selector that allows you to style .
Although the syntax of the jquery selector may look the same as the css pseudo-class, it is different.
By the way, it is not possible to programmatically change the style of css pseudo-classes ( :hover ...).
source share