Admin bar hover fixes. Props filosofo. see #15307

git-svn-id: https://develop.svn.wordpress.org/trunk@16274 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-11-10 16:19:55 +00:00
parent 66d261ba84
commit 38c6bcbb55
3 changed files with 25 additions and 3 deletions
+23 -1
View File
@@ -8,6 +8,9 @@
aB, hc = new RegExp('\\bhover\\b', 'g'), q = [],
/**
* Get the timeout ID of the given element
*/
getTOID = function(el) {
var i = q.length;
while( i-- )
@@ -17,15 +20,34 @@
},
addClass = function(t) {
var ancestors = [],
ancestorLength = 0,
id,
i = q.length,
inA;
while ( t && t != aB && t != d ) {
if( 'LI' == t.nodeName.toUpperCase() ) {
var id = getTOID(t);
ancestors[ ancestors.length ] = t;
id = getTOID(t);
if ( id )
clearTimeout( id );
t.className = t.className ? ( t.className.replace(hc, '') + ' hover' ) : 'hover';
}
t = t.parentNode;
}
/* remove the hover class for any objects not in the immediate element's ancestry */
while ( i-- ) {
inA = false;
ancestorLength = ancestors.length;
while( ancestorLength-- ) {
if ( ancestors[ ancestorLength ] == q[i][1] )
inA = true;
}
if ( ! inA )
q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : '';
}
},
removeClass = function(t) {