Unfortunately :after renders as unknown in ie6 :(

So no luck there...

2007/9/21, Christian Bach <[EMAIL PROTECTED]>:
>
> That would be way cool, and not to hard to implement!
>
> /christian
>
> 2007/9/21, Brandon Aaron <[EMAIL PROTECTED]>:
> >
> > Well why not fix :after and :before too :)
> >
> > --
> > Brandon Aaron
> >
> > On 9/21/07, Christian Bach < [EMAIL PROTECTED] > wrote:
> > >
> > > Yeah that would make sense!
> > >
> > > A other thing that could be use full is to have a fix for the :focus
> > > selector in IE6.
> > > All though it will be returned as "unknown" in ie6.
> > >
> > >
> > > If you want to make a plugin and release it it's fine by me.
> > >
> > > /christian
> > >
> > > 2007/9/21, Fabien Meghazi < [EMAIL PROTECTED]>:
> > > >
> > > >
> > > > > > 1. The script only looks for declarations in the stylesheets,
> > > > that's the
> > > > > > beauty of it.
> > > > > yes, but I mean that if you look at the content of the cssRules
> > > > > variable you will see that there are a lot of css declaration
> > > > which
> > > > > could be avoided (or they can't ?)
> > > >
> > > > Christian,
> > > >
> > > > Ok, here's what I meant :
> > > > In parseCss(), checking if css selector contains ":hover" (and
> > > > return
> > > > if not) will only do stuff on css selectors where :hover is present.
> > > > I
> > > > guess in most cases this is what we want. (correct me if I'm wrong).
> > > > It's quite faster (I can feel it because I've got a 1ghz laptop :-)
> > > >
> > > > Anyway, here's a version of your script where we can choose if stuff
> > > >
> > > > should be done only for :hover selectors or not.
> > > >
> > > > Calling $.ie6HoverFix(); has the normal behaviour as you designed
> > > > it.
> > > > Calling $.ie6HoverFix(true);  will redo css declaration only for
> > > > :hover selectors
> > > >
> > > > Here it is. What do you think ?
> > > >
> > > > // ie6HoverFix - Author : Christian Bach
> > > > $.ie6HoverFix = function(only_hovers) {
> > > >         if ($.browser.msie && $.browser.version < 7) {
> > > >                 only_hovers = only_hovers || false;
> > > >                 var cssRules = [], newStyleSheet =
> > > > document.createStyleSheet(),
> > > > styleSheets = document.styleSheets;
> > > >                 function parseCSS(rule) {
> > > >                         var prefix = "ie6fix-";
> > > >                         var select = rule.selectorText, style =
> > > > rule.style.cssText;
> > > >                         if (only_hovers && select.indexOf(":hover")
> > > > == -1) {
> > > >                                 return;
> > > >                         }
> > > >                         var element = select.replace(/:(hover).*$/,
> > > > '');
> > > >                         var pseudo = 
> > > > select.replace(/[^:]+:([a-z-]+).*/i,
> > > > '$1');
> > > >                         var styleRule = element + "." + prefix +
> > > > pseudo;
> > > >                         var className = prefix + pseudo;
> > > >                         $(element).hover(function(e) {
> > > >                                 $(this).addClass(className);
> > > >                         }, function(e) {
> > > >                                 $(this).removeClass(className)
> > > >                         });
> > > >                         cssRules.push([styleRule,style]);
> > > >                 }
> > > >                 for (var i = 0, ii = styleSheets.length ; i < ii;
> > > > i++) {
> > > >                         for(var j = 0, jj =
> > > > styleSheets[i].rules.length; j < jj; j++) {
> > > >                                 parseCSS(styleSheets[i].rules[j]);
> > > >                         }
> > > >                 }
> > > >                 for (var i = 0, ii = cssRules.length; i < ii; i++) {
> > > >                         var ruledef = cssRules[i][1];
> > > >                         if (ruledef.length != 0) {
> > > >                                  newStyleSheet.addRule(cssRules[i][0],
> > > > ruledef);
> > > >                         }
> > > >                 }
> > > >         }
> > > > };
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Fabien Meghazi
> > > >
> > > > Website: http://www.amigrave.com
> > > > Email: [EMAIL PROTECTED]
> > > > IM: [EMAIL PROTECTED]
> > > >
> > >
> > >
> >
>

Reply via email to