Skip to content

Instantly share code, notes, and snippets.

@kotarok
Created December 4, 2010 00:37
Show Gist options
  • Save kotarok/727769 to your computer and use it in GitHub Desktop.
Save kotarok/727769 to your computer and use it in GitHub Desktop.
In this gist, add 'first-child' class for first-child element. This runs expression only one time. So browser doesn't get slow.
.someClass{
behavior: expression(this.style.behavior || ((function(a,b,c){
c=a.parentNode.getElementsByTagName('!');
try{for(var i=0,l=c.length;i<l;i++){c[i].parentNode.removeChild(c[i])}}catch(e){};
if(a.parentNode.firstChild==a){a.className+=' '+b}
})(this,"lu.first-child"),1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment