IE 5-8 CSS3 pseudo-class selector emulation: ie-css3.js
Posted on January 29, 2010, under JavaScript,
Bookmark it
ie-css3.js is JS Script that allows Internet Explorer browser to identify CSS3 pseudo-class selectors and render any style rules defined with them. To use it, you will have to download ie-css3.js and one of the supported JavaScript libraries and include them both in the page of your
website.
First, ie-css3.js makes a check for known JavaScript libraries and selects the one with the best CSS3 selector support. Next, the stylesheets are downloaded and each of their selectors are parsed. Any CSS3 pseudo-classes are replaced by a standard CSS class of a similar name (e.g. div:nth-child(2) becomes div.iecss-nth-child-2). After that, the detected JavaScript library is used to find the DOM nodes matching the original CSS3 selector and the same CSS class is applied to them. Finally, the stylesheet gets replaced with the new one and any elements targeted with CSS3 pseudo-classes will be styled.
A few things you should know:
- Style sheets MUST be added using the
<link>tag. Page level style sheets won’t pe parsed - Style sheets that use the
file://protocol will not work due to browser security restrictions - Style sheets MUST be hosted on the domain as the page
- The emulation is not dynamic. The styles are fixed once they are applied. Changes to the DOM won’t be reflected.
- The
:not()pseudo selector is not supported (it’s coming though)
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- January 29, 2010
- article by Gabriel C.
- Share your thoughts!
Related Posts
-
CSS3 Decorations for Internet Explorer 6-8: CSS3 Pieat February 8, 2011 with 11 comments
-
Create pretty CSS3 scaleable buttonsat January 31, 2010
-
Create Super Awesome Buttons using CSS3 and RGBAat July 25, 2009 with 1 comment
-
Select/Unselect checkbox(es) with Class Changer (Highlighter)at December 28, 2008 with 1 comment
-
Target specific browsers by custom classes: .css{user:agent;}at January 3, 2011

