i need some script that works with elements classNames, i used heavily jquery's addClass, removeClass, toggleClass to get tricky combinations of classes, and that's what i discovered:
 
in Opera 9 strange space appears in the beginning of complex classNames...
for example:
while in FF elements className after series of events states: "white active"
in Opera the same element after same events has classNames: " active white"
 
so in Opera this styles won't apply for this element (while FF behaves as expected):
td.white.active{
    background:#FFF;
    border-color:#F00;
}
 
right now for temporarily solution i changed the jquery lib source code:
 
jQuery.className = {
 add: function(o,c){
  if (jQuery.hasWord(o,c)) return;
  o.className += ( o.className ? " " : "" ) + c;
  // ltrim:
  while (o.className.substring(0,1) == ' '){
   o.className = o.className.substring(1, o.className.length);
  }
 },
 remove: function(o,c){
  o.className = !c ? "" :
   o.className.replace(
    new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");
  // ltrim:
  while (o.className.substring(0,1) == ' '){
   o.className = o.className.substring(1, o.className.length);
  }
 }
};
 
but maybe, you will take it into consideration, do some cross-browser tests andremove this bug...
 
P.S. - i'm not sure, but i guess the same bug appears in IE either
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to