vendor prefix - Why can't I combine ::selection and ::-moz-selection in one CSS rule? -


i'm big fan of using ::selection , ::-moz-selection spruce website bit - hate default blue , white colours!

however, find 1 little thing bugs me: can't put ::selection , ::-moz-selection in same css rule, this:

::selection, ::-moz-selection {     background:#8a1920;     color:#ffff; } 

jsfiddle link

i find quite annoying, because means if want change background colour (or other selection style) have edit 2 separate rules. violates policy follow religiously: d.r.y. (don't repeat yourself).

i tested in chrome 28, chrome canary 30, firefox 22, firefox 23, ie 9 , ie 10 , yield same result. what's going wrong here?

if must remain separate, there way have them join further on? like:

.selected {     background:#8a1920;     color:#fff; }  ::selection {     @copy-from(.selected); /* know line made */ }  ::-moz-selection {     @copy-from(.selected); } 

would useful.

this documentation:

gecko engine requiring prefix. due fact css parsing rules require dropping whole rule when encountering invalid pseudo-element, 2 separate rules must written: ::-moz-selection, ::selection {...}. rule dropped on non-gecko browsers ::-moz-selection invalid on them.

https://developer.mozilla.org/en-us/docs/web/css/::selection


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -