Alternative to css3 not selector
- by Raynos
Are there any alternatives to the :not css3 selector that are compliant with IE8 (and quirks mode).
Either in css or javascript/jquery that emulates the selector or something similar.
I am using *:not as follows below. Feel free to recommend a solution that avoids the use of :not completely.
@media screen {
#printable {
visibility: hidden;
}
}
@media print {
*:not(#printable) {
visibility: hidden;
}
#printable {
position: absolute;
visibility: visible;
}
}
Note that the use of :not is tied to the use of @media print so just using a simple jQuery solution to apply css to $(":not(#printable)") won't work without being clever.
Including an entire library like ie9.js or selectivirz isn't an option as it can effect various other parts of the pages and would involve a large section of re-testing.
a jsfiddle that shows it working in browsers that support :not http://jsfiddle.net/Raynos/TjKbz/