<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16274] trunk/wp-includes: Admin bar hover fixes.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16274">16274</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-10 16:19:55 +0000 (Wed, 10 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Admin bar hover fixes. Props filosofo. see <a href="http://trac.wordpress.org/ticket/15307">#15307</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsadminbardevjs">trunk/wp-includes/js/admin-bar.dev.js</a></li>
<li><a href="#trunkwpincludesjsadminbarjs">trunk/wp-includes/js/admin-bar.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjsadminbardevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/admin-bar.dev.js (16273 => 16274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/admin-bar.dev.js        2010-11-10 14:50:14 UTC (rev 16273)
+++ trunk/wp-includes/js/admin-bar.dev.js        2010-11-10 16:19:55 UTC (rev 16274)
</span><span class="lines">@@ -8,6 +8,9 @@
</span><span class="cx">
</span><span class="cx">         aB, hc = new RegExp('\\bhover\\b', 'g'), q = [],
</span><span class="cx">
</span><ins>+        /**
+         * Get the timeout ID of the given element
+         */
</ins><span class="cx">         getTOID = function(el) {
</span><span class="cx">                 var i = q.length;
</span><span class="cx">                 while( i-- )
</span><span class="lines">@@ -17,15 +20,34 @@
</span><span class="cx">         },
</span><span class="cx">
</span><span class="cx">         addClass = function(t) {
</span><ins>+                var ancestors = [],
+                ancestorLength = 0,
+                id,
+                i = q.length,
+                inA;
</ins><span class="cx">                 while ( t && t != aB && t != d ) {
</span><span class="cx">                         if( 'LI' == t.nodeName.toUpperCase() ) {
</span><del>-                                var id = getTOID(t);        
</del><ins>+                                ancestors[ ancestors.length ] = t;
+                                id = getTOID(t);        
</ins><span class="cx">                                 if ( id )
</span><span class="cx">                                         clearTimeout( id );
</span><span class="cx">                                 t.className = t.className ? ( t.className.replace(hc, '') + ' hover' ) : 'hover';
</span><span class="cx">                         }
</span><span class="cx">                         t = t.parentNode;
</span><span class="cx">                 }
</span><ins>+                
+                /* 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, '') : '';
+                }
</ins><span class="cx">         },
</span><span class="cx">
</span><span class="cx">         removeClass = function(t) {
</span></span></pre></div>
<a id="trunkwpincludesjsadminbarjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/admin-bar.js (16273 => 16274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/admin-bar.js        2010-11-10 14:50:14 UTC (rev 16273)
+++ trunk/wp-includes/js/admin-bar.js        2010-11-10 16:19:55 UTC (rev 16274)
</span><span class="lines">@@ -1 +1 @@
</span><del>-(function(i,j){var c=function(m,l,d){if(m.addEventListener){m.addEventListener(l,d,false)}else{if(m.attachEvent){m.attachEvent("on"+l,function(){return d.call(m,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],g=function(l){var d=a.length;while(d--){if(a[d]&&l==a[d][1]){return a[d][0]}}return false},h=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){var l=g(d);if(l){clearTimeout(l)}d.className=d.className?(d.className.replace(f,"")+" hover"):"hover"}d=d.parentNode}},k=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(l){var m=setTimeout(function(){l.className=l.className?l.className.replace(f,""):""},500);a[a.length]=[m,l]})(d)}d=d.parentNode}},b=function(n){var m=n.target||n.srcElement,d,l;if("undefined"==typeof adminBarL10n){return}while(m&&m!=e&&m!=i&&(!m.className||-1==m.className.indexOf("ab-get-shortlink"))){m=m.parentNode}if(m&&m.className&&-1!=m.className.indexOf("ab-get-shortlink")){d=i.getElementsByTagName("link");if(!d.length){d=i.links}l=d.length;if(n.preventDefault){n.preventDefault()}n.returnValue=false;while(l--){if(d[l]&&"shortlink"==d[l].getAttribute("rel")){prompt(adminBarL10n.url,d[l].href);return false}}alert(adminBarL10n.noShortlink);return false}};c(j,"load",function(){var d=i.getElementsByTagName("body")[0],l=i.getElementById("adminbar-search");e=i.getElementById("wpadminbar");if(d&&e){d.appendChild(e);c(e,"mouseover",function(m){h(m.target||m.srcElement)});c(e,"mouseout",function(m){k(m.target||m.srcElement)});c(e,"click",b)}if(l){if(""==l.value){l.value=l.getAttribute("title")}l.onblur=function(){this.value=""==this.value?this.getAttribute("title"):this.value};l.onfocus=function(){this.value=this.getAttribute("title")==this.value?"":this.value}}if(j.location.hash){j.scrollBy(0,-32)}})})(document,window);
</del><span class="cx">\ No newline at end of file
</span><ins>+(function(i,j){var c=function(m,l,d){if(m.addEventListener){m.addEventListener(l,d,false)}else{if(m.attachEvent){m.attachEvent("on"+l,function(){return d.call(m,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],g=function(l){var d=a.length;while(d--){if(a[d]&&l==a[d][1]){return a[d][0]}}return false},h=function(l){var m=[],p=0,o,d=a.length,n;while(l&&l!=e&&l!=i){if("LI"==l.nodeName.toUpperCase()){m[m.length]=l;o=g(l);if(o){clearTimeout(o)}l.className=l.className?(l.className.replace(f,"")+" hover"):"hover"}l=l.parentNode}while(d--){n=false;p=m.length;while(p--){if(m[p]==a[d][1]){n=true}}if(!n){a[d][1].className=a[d][1].className?a[d][1].className.replace(f,""):""}}},k=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(l){var m=setTimeout(function(){l.className=l.className?l.className.replace(f,""):""},500);a[a.length]=[m,l]})(d)}d=d.parentNode}},b=function(n){var m=n.target||n.srcElement,d,l;if("undefined"==typeof adminBarL10n){return}while(m&&m!=e&&m!=i&&(!m.className||-1==m.className.indexOf("ab-get-shortlink"))){m=m.parentNode}if(m&&m.className&&-1!=m.className.indexOf("ab-get-shortlink")){d=i.getElementsByTagName("link");if(!d.length){d=i.links}l=d.length;if(n.preventDefault){n.preventDefault()}n.returnValue=false;while(l--){if(d[l]&&"shortlink"==d[l].getAttribute("rel")){prompt(adminBarL10n.url,d[l].href);return false}}alert(adminBarL10n.noShortlink);return false}};c(j,"load",function(){var d=i.getElementsByTagName("body")[0],l=i.getElementById("adminbar-search");e=i.getElementById("wpadminbar");if(d&&e){d.appendChild(e);c(e,"mouseover",function(m){h(m.target||m.srcElement)});c(e,"mouseout",function(m){k(m.target||m.srcElement)});c(e,"click",b)}if(l){if(""==l.value){l.value=l.getAttribute("title")}l.onblur=function(){this.value=""==this.value?this.getAttribute("title"):this.value};l.onfocus=function(){this.value=this.getAttribute("title")==this.value?"":this.value}}if(j.location.hash){j.scrollBy(0,-32)}})})(document,window);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (16273 => 16274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-11-10 14:50:14 UTC (rev 16273)
+++ trunk/wp-includes/script-loader.php        2010-11-10 16:19:55 UTC (rev 16274)
</span><span class="lines">@@ -499,7 +499,7 @@
</span><span class="cx">         $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
</span><span class="cx">         
</span><span class="cx">         // Admin bar
</span><del>-        $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101029' );
</del><ins>+        $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101110' );
</ins><span class="cx">
</span><span class="cx">         foreach ( $rtl_styles as $rtl_style ) {
</span><span class="cx">                 $styles->add_data( $rtl_style, 'rtl', true );
</span></span></pre>
</div>
</div>
</body>
</html>