Is there a faster way to give ":before" and ":after" selector support in IE7?
My design currently calls for a lot of :before
and :after
selectors. IE7 does not support these selectors so, after a little digging, I am开发者_Go百科 now using IE7.js (the IE8 version).
Whilst it does work, there is a noticeable lag (approx 15-20 seconds).
Can anyone recommend a faster alternative so that I can use the :before
and :after
psudo-element selectors in IE7?
I use this CSS hack in css:
.button {
*zoom: expression(
this.runtimeStyle.zoom="1",
this.insertBefore( document.createElement("div"), this.childNodes[0] ).className="before",
this.appendChild( document.createElement("div") ).className="after"
);
}
...and later simply:
.button:before,
.button .before{
...
}
From the comments:
If you have zillions of
:before
and:after
, the cause of the problem could be IE7's slowish JavaScript engine - if this is the case, I think you're out of luck - IE7.js is probably as efficient as you're going to get.
and:
@thirtydot I have a page with only one :before and :after and that is taking about 7-9 seconds, so I think you are right about it being the number of selectors I'm using.
IE7 :(
精彩评论