<!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" />
<title>[26163] trunk/src/wp-admin/js/nav-menu.js: Fix JSHint errors in nav-menu.js.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26163">26163</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-11-14 06:08:11 +0000 (Thu, 14 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix JSHint errors in nav-menu.js.

props atimmer.
fixes <a href="http://core.trac.wordpress.org/ticket/25953">#25953</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsnavmenujs">trunk/src/wp-admin/js/nav-menu.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/nav-menu.js (26162 => 26163)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/nav-menu.js        2013-11-14 05:55:46 UTC (rev 26162)
+++ trunk/src/wp-admin/js/nav-menu.js   2013-11-14 06:08:11 UTC (rev 26163)
</span><span class="lines">@@ -8,12 +8,16 @@
</span><span class="cx">  * @subpackage Administration
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+/* global menus, postboxes, columns, isRtl, navMenuL10n, ajaxurl */
+
</ins><span class="cx"> var wpNavMenu;
</span><span class="cx"> 
</span><span class="cx"> (function($) {
</span><span class="cx"> 
</span><del>-       var api = wpNavMenu = {
</del><ins>+        var api;
</ins><span class="cx"> 
</span><ins>+       api = wpNavMenu = {
+
</ins><span class="cx">           options : {
</span><span class="cx">                  menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead.
</span><span class="cx">                  globalMaxDepth : 11
</span><span class="lines">@@ -111,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx">                                          // If it has children, move those too
</span><span class="cx">                                          if ( children ) {
</span><del>-                                                       children.each(function( index ) {
</del><ins>+                                                        children.each(function() {
</ins><span class="cx">                                                           var t = $(this),
</span><span class="cx">                                                                  thisDepth = t.menuItemDepth(),
</span><span class="cx">                                                                  newDepth = thisDepth + diff;
</span><span class="lines">@@ -130,11 +134,11 @@
</span><span class="cx">                                  return this.each(function(){
</span><span class="cx">                                          var item = $(this),
</span><span class="cx">                                                  input = item.find( '.menu-item-data-parent-id' ),
</span><del>-                                                       depth = parseInt( item.menuItemDepth() ),
</del><ins>+                                                        depth = parseInt( item.menuItemDepth(), 10 ),
</ins><span class="cx">                                                   parentDepth = depth - 1,
</span><span class="cx">                                                  parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
</span><span class="cx"> 
</span><del>-                                               if ( 0 == depth ) { // Item is on the top level, has no parent
</del><ins>+                                                if ( 0 === depth ) { // Item is on the top level, has no parent
</ins><span class="cx">                                                   input.val(0);
</span><span class="cx">                                          } else { // Find the parent item, and retrieve its object id.
</span><span class="cx">                                                  input.val( parent.find( '.menu-item-data-db-id' ).val() );
</span><span class="lines">@@ -155,14 +159,14 @@
</span><span class="cx">                           * @param jQuery metabox The metabox jQuery object.
</span><span class="cx">                           */
</span><span class="cx">                          addSelectedToMenu : function(processMethod) {
</span><del>-                                       if ( 0 == $('#menu-to-edit').length ) {
</del><ins>+                                        if ( 0 === $('#menu-to-edit').length ) {
</ins><span class="cx">                                           return false;
</span><span class="cx">                                  }
</span><span class="cx"> 
</span><span class="cx">                                  return this.each(function() {
</span><span class="cx">                                          var t = $(this), menuItems = {},
</span><del>-                                                       checkboxes = ( menus.oneThemeLocationNoMenus && 0 == t.find('.tabs-panel-active .categorychecklist li input:checked').length ) ? t.find('#page-all li input[type="checkbox"]') : t.find('.tabs-panel-active .categorychecklist li input:checked'),
-                                                       re = new RegExp('menu-item\\[(\[^\\]\]*)');
</del><ins>+                                                        checkboxes = ( menus.oneThemeLocationNoMenus && 0 === t.find( '.tabs-panel-active .categorychecklist li input:checked' ).length ) ? t.find( '#page-all li input[type="checkbox"]' ) : t.find( '.tabs-panel-active .categorychecklist li input:checked' ),
+                                                       re = /menu-item\[([^]\]*)/;
</ins><span class="cx"> 
</span><span class="cx">                                          processMethod = processMethod || api.addMenuItemToBottom;
</span><span class="cx"> 
</span><span class="lines">@@ -271,23 +275,24 @@
</span><span class="cx"> 
</span><span class="cx">          moveMenuItem : function( $this, dir ) {
</span><span class="cx"> 
</span><del>-                       var menuItems = $('#menu-to-edit li');
</del><ins>+                        var items, newItemPosition, newDepth,
+                               menuItems = $( '#menu-to-edit li' ),
</ins><span class="cx">                           menuItemsCount = menuItems.length,
</span><span class="cx">                          thisItem = $this.parents( 'li.menu-item' ),
</span><span class="cx">                          thisItemChildren = thisItem.childMenuItems(),
</span><span class="cx">                          thisItemData = thisItem.getItemData(),
</span><del>-                               thisItemDepth = parseInt( thisItem.menuItemDepth() ),
-                               thisItemPosition = parseInt( thisItem.index() ),
</del><ins>+                                thisItemDepth = parseInt( thisItem.menuItemDepth(), 10 ),
+                               thisItemPosition = parseInt( thisItem.index(), 10 ),
</ins><span class="cx">                           nextItem = thisItem.next(),
</span><span class="cx">                          nextItemChildren = nextItem.childMenuItems(),
</span><del>-                               nextItemDepth = parseInt( nextItem.menuItemDepth() ) + 1,
</del><ins>+                                nextItemDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1,
</ins><span class="cx">                           prevItem = thisItem.prev(),
</span><del>-                               prevItemDepth = parseInt( prevItem.menuItemDepth() ),
</del><ins>+                                prevItemDepth = parseInt( prevItem.menuItemDepth(), 10 ),
</ins><span class="cx">                           prevItemId = prevItem.getItemData()['menu-item-db-id'];
</span><span class="cx"> 
</span><span class="cx">                  switch ( dir ) {
</span><span class="cx">                  case 'up':
</span><del>-                               var newItemPosition = thisItemPosition - 1;
</del><ins>+                                newItemPosition = thisItemPosition - 1;
</ins><span class="cx"> 
</span><span class="cx">                          // Already at top
</span><span class="cx">                          if ( 0 === thisItemPosition )
</span><span class="lines">@@ -303,7 +308,7 @@
</span><span class="cx"> 
</span><span class="cx">                          // Does this item have sub items?
</span><span class="cx">                          if ( thisItemChildren ) {
</span><del>-                                       var items = thisItem.add( thisItemChildren );
</del><ins>+                                        items = thisItem.add( thisItemChildren );
</ins><span class="cx">                                   // Move the entire block
</span><span class="cx">                                  items.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
</span><span class="cx">                          } else {
</span><span class="lines">@@ -313,12 +318,12 @@
</span><span class="cx">                  case 'down':
</span><span class="cx">                          // Does this item have sub items?
</span><span class="cx">                          if ( thisItemChildren ) {
</span><del>-                                       var items = thisItem.add( thisItemChildren ),
</del><ins>+                                        items = thisItem.add( thisItemChildren ),
</ins><span class="cx">                                           nextItem = menuItems.eq( items.length + thisItemPosition ),
</span><span class="cx">                                          nextItemChildren = 0 !== nextItem.childMenuItems().length;
</span><span class="cx"> 
</span><span class="cx">                                  if ( nextItemChildren ) {
</span><del>-                                               var newDepth = parseInt( nextItem.menuItemDepth() ) + 1;
</del><ins>+                                                newDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1;
</ins><span class="cx">                                           thisItem.moveHorizontally( newDepth, thisItemDepth );
</span><span class="cx">                                  }
</span><span class="cx"> 
</span><span class="lines">@@ -344,7 +349,7 @@
</span><span class="cx">                                  break;
</span><span class="cx">                          // Does this item have sub items?
</span><span class="cx">                          if ( thisItemChildren ) {
</span><del>-                                       var items = thisItem.add( thisItemChildren );
</del><ins>+                                        items = thisItem.add( thisItemChildren );
</ins><span class="cx">                                   // Move the entire block
</span><span class="cx">                                  items.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
</span><span class="cx">                          } else {
</span><span class="lines">@@ -406,15 +411,15 @@
</span><span class="cx">                  $( '.menu-item-settings .field-move a' ).css( 'display', 'none' );
</span><span class="cx"> 
</span><span class="cx">                  $( '.item-edit' ).each( function() {
</span><del>-                               var $this = $(this),
-                                       movement = [],
-                                       availableMovement = '',
</del><ins>+                                var thisLink, thisLinkText, primaryItems, itemPosition, title,
+                                       parentItem, parentItemId, parentItemName, subItems,
+                                       $this = $(this),
</ins><span class="cx">                                   menuItem = $this.closest( 'li.menu-item' ).first(),
</span><span class="cx">                                  depth = menuItem.menuItemDepth(),
</span><span class="cx">                                  isPrimaryMenuItem = ( 0 === depth ),
</span><span class="cx">                                  itemName = $this.closest( '.menu-item-handle' ).find( '.menu-item-title' ).text(),
</span><del>-                                       position = parseInt( menuItem.index() ),
-                                       prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1 ),
</del><ins>+                                        position = parseInt( menuItem.index(), 10 ),
+                                       prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1, 10 ),
</ins><span class="cx">                                   prevItemNameLeft = menuItem.prevAll('.menu-item-depth-' + prevItemDepth).first().find( '.menu-item-title' ).text(),
</span><span class="cx">                                  prevItemNameRight = menuItem.prevAll('.menu-item-depth-' + depth).first().find( '.menu-item-title' ).text(),
</span><span class="cx">                                  totalMenuItems = $('#menu-to-edit li').length,
</span><span class="lines">@@ -422,55 +427,55 @@
</span><span class="cx"> 
</span><span class="cx">                          // Where can they move this menu item?
</span><span class="cx">                          if ( 0 !== position ) {
</span><del>-                                       var thisLink = menuItem.find( '.menus-move-up' );
</del><ins>+                                        thisLink = menuItem.find( '.menus-move-up' );
</ins><span class="cx">                                   thisLink.prop( 'title', menus.moveUp ).css( 'display', 'inline' );
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( 0 !== position && isPrimaryMenuItem ) {
</span><del>-                                       var thisLink = menuItem.find( '.menus-move-top' );
</del><ins>+                                        thisLink = menuItem.find( '.menus-move-top' );
</ins><span class="cx">                                   thisLink.prop( 'title', menus.moveToTop ).css( 'display', 'inline' );
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( position + 1 !== totalMenuItems && 0 !== position ) {
</span><del>-                                       var thisLink = menuItem.find( '.menus-move-down' );
</del><ins>+                                        thisLink = menuItem.find( '.menus-move-down' );
</ins><span class="cx">                                   thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( 0 === position && 0 !== hasSameDepthSibling ) {
</span><del>-                                       var thisLink = menuItem.find( '.menus-move-down' );
</del><ins>+                                        thisLink = menuItem.find( '.menus-move-down' );
</ins><span class="cx">                                   thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( ! isPrimaryMenuItem ) {
</span><del>-                                       var thisLink = menuItem.find( '.menus-move-left' ),
-                                               thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
</del><ins>+                                        thisLink = menuItem.find( '.menus-move-left' ),
+                                       thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
</ins><span class="cx">                                   thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).html( thisLinkText ).css( 'display', 'inline' );
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( 0 !== position ) {
</span><span class="cx">                                  if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) {
</span><del>-                                               var thisLink = menuItem.find( '.menus-move-right' ),
-                                                       thisLinkText = menus.under.replace( '%s', prevItemNameRight );
</del><ins>+                                                thisLink = menuItem.find( '.menus-move-right' ),
+                                               thisLinkText = menus.under.replace( '%s', prevItemNameRight );
</ins><span class="cx">                                           thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).html( thisLinkText ).css( 'display', 'inline' );
</span><span class="cx">                                  }
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          if ( isPrimaryMenuItem ) {
</span><del>-                                       var primaryItems = $( '.menu-item-depth-0' ),
-                                               itemPosition = primaryItems.index( menuItem ) + 1,
-                                               totalMenuItems = primaryItems.length,
</del><ins>+                                        primaryItems = $( '.menu-item-depth-0' ),
+                                       itemPosition = primaryItems.index( menuItem ) + 1,
+                                       totalMenuItems = primaryItems.length,
</ins><span class="cx"> 
</span><del>-                                               // String together help text for primary menu items
-                                               title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
</del><ins>+                                        // String together help text for primary menu items
+                                       title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
</ins><span class="cx">                           } else {
</span><del>-                                       var parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1 ) ).first(),
-                                               parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
-                                               parentItemName = parentItem.find( '.menu-item-title' ).text(),
-                                               subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
-                                               itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
</del><ins>+                                        parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
+                                       parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
+                                       parentItemName = parentItem.find( '.menu-item-title' ).text(),
+                                       subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
+                                       itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
</ins><span class="cx"> 
</span><del>-                                               // String together help text for sub menu items
-                                               title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
</del><ins>+                                        // String together help text for sub menu items
+                                       title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
</ins><span class="cx">                           }
</span><span class="cx"> 
</span><span class="cx">                          $this.prop('title', title).html( title );
</span><span class="lines">@@ -481,7 +486,10 @@
</span><span class="cx">                  $( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
</span><span class="cx">                          $(this).off( 'keydown' ).on( 'keydown', function(e){
</span><span class="cx"> 
</span><del>-                                       var $this = $(this);
</del><ins>+                                        var arrows,
+                                               $this = $( this ),
+                                               thisItem = $this.parents( 'li.menu-item' ),
+                                               thisItemData = thisItem.getItemData();
</ins><span class="cx"> 
</span><span class="cx">                                  // Bail if it's not an arrow key
</span><span class="cx">                                  if ( 37 != e.which && 38 != e.which && 39 != e.which && 40 != e.which )
</span><span class="lines">@@ -495,7 +503,7 @@
</span><span class="cx">                                          return;
</span><span class="cx"> 
</span><span class="cx">                                  // If RTL, swap left/right arrows
</span><del>-                                       var arrows = { '38' : 'up', '40' : 'down', '37' : 'left', '39' : 'right' };
</del><ins>+                                        arrows = { '38': 'up', '40': 'down', '37': 'left', '39': 'right' };
</ins><span class="cx">                                   if ( $('body').hasClass('rtl') )
</span><span class="cx">                                          arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
</span><span class="cx"> 
</span><span class="lines">@@ -528,10 +536,10 @@
</span><span class="cx">                  columns.useCheckboxesForHidden();
</span><span class="cx">                  columns.checked = function(field) {
</span><span class="cx">                          $('.field-' + field).removeClass('hidden-field');
</span><del>-                       }
</del><ins>+                        };
</ins><span class="cx">                   columns.unchecked = function(field) {
</span><span class="cx">                          $('.field-' + field).addClass('hidden-field');
</span><del>-                       }
</del><ins>+                        };
</ins><span class="cx">                   // hide fields
</span><span class="cx">                  api.menuList.hideAdvancedMenuItemFields();
</span><span class="cx"> 
</span><span class="lines">@@ -553,7 +561,7 @@
</span><span class="cx">                          body = $('body'), maxChildDepth,
</span><span class="cx">                          menuMaxDepth = initialMenuMaxDepth();
</span><span class="cx"> 
</span><del>-                       if( 0 != $( '#menu-to-edit li' ).length )
</del><ins>+                        if( 0 !== $( '#menu-to-edit li' ).length )
</ins><span class="cx">                           $( '.drag-instructions' ).show();
</span><span class="cx"> 
</span><span class="cx">                  // Use the right edge if RTL.
</span><span class="lines">@@ -605,7 +613,7 @@
</span><span class="cx">                                  tempHolder = ui.placeholder.next();
</span><span class="cx">                                  tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder
</span><span class="cx">                                  ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item
</span><del>-                                       $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know.
</del><ins>+                                        $(this).sortable( 'refresh' ); // The children aren't sortable. We should let jQ UI know.
</ins><span class="cx">                                   ui.item.after( ui.placeholder ); // reattach the placeholder.
</span><span class="cx">                                  tempHolder.css('margin-top', 0); // reset the margin
</span><span class="cx"> 
</span><span class="lines">@@ -613,20 +621,21 @@
</span><span class="cx">                                  updateSharedVars(ui);
</span><span class="cx">                          },
</span><span class="cx">                          stop: function(e, ui) {
</span><del>-                                       var children, depthChange = currentDepth - originalDepth;
</del><ins>+                                        var children, subMenuTitle,
+                                               depthChange = currentDepth - originalDepth;
</ins><span class="cx"> 
</span><span class="cx">                                  // Return child elements to the list
</span><span class="cx">                                  children = transport.children().insertAfter(ui.item);
</span><span class="cx"> 
</span><span class="cx">                                  // Add "sub menu" description
</span><del>-                                       var subMenuTitle = ui.item.find( '.item-title .is-submenu' );
</del><ins>+                                        subMenuTitle = ui.item.find( '.item-title .is-submenu' );
</ins><span class="cx">                                   if ( 0 < currentDepth )
</span><span class="cx">                                          subMenuTitle.show();
</span><span class="cx">                                  else
</span><span class="cx">                                          subMenuTitle.hide();
</span><span class="cx"> 
</span><span class="cx">                                  // Update depth classes
</span><del>-                                       if( depthChange != 0 ) {
</del><ins>+                                        if ( 0 !== depthChange ) {
</ins><span class="cx">                                           ui.item.updateDepthClass( currentDepth );
</span><span class="cx">                                          children.shiftDepthClass( depthChange );
</span><span class="cx">                                          updateMenuMaxDepth( depthChange );
</span><span class="lines">@@ -673,7 +682,7 @@
</span><span class="cx">                                  if( nextThreshold && offset.top + helperHeight > nextThreshold ) {
</span><span class="cx">                                          next.after( ui.placeholder );
</span><span class="cx">                                          updateSharedVars( ui );
</span><del>-                                               $(this).sortable( "refreshPositions" );
</del><ins>+                                                $( this ).sortable( 'refreshPositions' );
</ins><span class="cx">                                   }
</span><span class="cx">                          }
</span><span class="cx">                  });
</span><span class="lines">@@ -706,7 +715,7 @@
</span><span class="cx">                  function initialMenuMaxDepth() {
</span><span class="cx">                          if( ! body[0].className ) return 0;
</span><span class="cx">                          var match = body[0].className.match(/menu-max-depth-(\d+)/);
</span><del>-                               return match && match[1] ? parseInt(match[1]) : 0;
</del><ins>+                                return match && match[1] ? parseInt( match[1], 10 ) : 0;
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  function updateMenuMaxDepth( depthChange ) {
</span><span class="lines">@@ -760,7 +769,7 @@
</span><span class="cx">                  $('#add-custom-links input[type="text"]').keypress(function(e){
</span><span class="cx">                          if ( e.keyCode === 13 ) {
</span><span class="cx">                                  e.preventDefault();
</span><del>-                                       $("#submit-customlinkdiv").click();
</del><ins>+                                        $( '#submit-customlinkdiv' ).click();
</ins><span class="cx">                           }
</span><span class="cx">                  });
</span><span class="cx">          },
</span><span class="lines">@@ -779,7 +788,7 @@
</span><span class="cx">                          var $t = $(this), title = $t.attr('title'), val = $t.val();
</span><span class="cx">                          $t.data( name, title );
</span><span class="cx"> 
</span><del>-                               if( '' == val ) $t.val( title );
</del><ins>+                                if( '' === val ) $t.val( title );
</ins><span class="cx">                           else if ( title == val ) return;
</span><span class="cx">                          else $t.removeClass( name );
</span><span class="cx">                  }).focus( function(){
</span><span class="lines">@@ -788,7 +797,7 @@
</span><span class="cx">                                  $t.val('').removeClass( name );
</span><span class="cx">                  }).blur( function(){
</span><span class="cx">                          var $t = $(this);
</span><del>-                               if( '' == $t.val() )
</del><ins>+                                if( '' === $t.val() )
</ins><span class="cx">                                   $t.addClass( name ).val( $t.data(name) );
</span><span class="cx">                  });
</span><span class="cx"> 
</span><span class="lines">@@ -797,14 +806,14 @@
</span><span class="cx"> 
</span><span class="cx">          attachThemeLocationsListeners : function() {
</span><span class="cx">                  var loc = $('#nav-menu-theme-locations'), params = {};
</span><del>-                       params['action'] = 'menu-locations-save';
</del><ins>+                        params.action = 'menu-locations-save';
</ins><span class="cx">                   params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val();
</span><span class="cx">                  loc.find('input[type="submit"]').click(function() {
</span><span class="cx">                          loc.find('select').each(function() {
</span><span class="cx">                                  params[this.name] = $(this).val();
</span><span class="cx">                          });
</span><span class="cx">                          loc.find('.spinner').show();
</span><del>-                               $.post( ajaxurl, params, function(r) {
</del><ins>+                                $.post( ajaxurl, params, function() {
</ins><span class="cx">                                   loc.find('.spinner').hide();
</span><span class="cx">                          });
</span><span class="cx">                          return false;
</span><span class="lines">@@ -860,7 +869,7 @@
</span><span class="cx"> 
</span><span class="cx">                  processMethod = processMethod || api.addMenuItemToBottom;
</span><span class="cx"> 
</span><del>-                       if ( '' == url || 'http://' == url )
</del><ins>+                        if ( '' === url || 'http://' == url )
</ins><span class="cx">                           return false;
</span><span class="cx"> 
</span><span class="cx">                  // Show the ajax spinner
</span><span class="lines">@@ -889,7 +898,8 @@
</span><span class="cx"> 
</span><span class="cx">          addItemToMenu : function(menuItem, processMethod, callback) {
</span><span class="cx">                  var menu = $('#menu').val(),
</span><del>-                               nonce = $('#menu-settings-column-nonce').val();
</del><ins>+                                nonce = $('#menu-settings-column-nonce').val(),
+                               params;
</ins><span class="cx"> 
</span><span class="cx">                  processMethod = processMethod || function(){};
</span><span class="cx">                  callback = callback || function(){};
</span><span class="lines">@@ -923,13 +933,13 @@
</span><span class="cx">           * @param string menuMarkup The text server response of menu item markup.
</span><span class="cx">           * @param object req The request arguments.
</span><span class="cx">           */
</span><del>-               addMenuItemToBottom : function( menuMarkup, req ) {
</del><ins>+                addMenuItemToBottom : function( menuMarkup ) {
</ins><span class="cx">                   $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
</span><span class="cx">                  api.refreshKeyboardAccessibility();
</span><span class="cx">                  api.refreshAdvancedAccessibility();
</span><span class="cx">          },
</span><span class="cx"> 
</span><del>-               addMenuItemToTop : function( menuMarkup, req ) {
</del><ins>+                addMenuItemToTop : function( menuMarkup ) {
</ins><span class="cx">                   $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
</span><span class="cx">                  api.refreshKeyboardAccessibility();
</span><span class="cx">                  api.refreshAdvancedAccessibility();
</span><span class="lines">@@ -940,7 +950,7 @@
</span><span class="cx">                          api.registerChange();
</span><span class="cx">                  });
</span><span class="cx"> 
</span><del>-                       if ( 0 != $('#menu-to-edit').length || 0 != $('.menu-location-menus select').length ) {
</del><ins>+                        if ( 0 !== $('#menu-to-edit').length || 0 !== $('.menu-location-menus select').length ) {
</ins><span class="cx">                           window.onbeforeunload = function(){
</span><span class="cx">                                  if ( api.menusChanged )
</span><span class="cx">                                          return navMenuL10n.saveAlert;
</span><span class="lines">@@ -1008,10 +1018,10 @@
</span><span class="cx">                                                  placeholder = document.createElement('div'),
</span><span class="cx">                                                  wrap = document.createElement('div');
</span><span class="cx"> 
</span><del>-                                                       if ( ! metaBoxData['markup'] || ! toReplace )
</del><ins>+                                                        if ( ! metaBoxData.markup || ! toReplace )
</ins><span class="cx">                                                           return;
</span><span class="cx"> 
</span><del>-                                                       wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : '';
</del><ins>+                                                        wrap.innerHTML = metaBoxData.markup ? metaBoxData.markup : '';
</ins><span class="cx"> 
</span><span class="cx">                                                  toReplace.parentNode.insertBefore( placeholder, toReplace );
</span><span class="cx">                                                  placeholder.parentNode.removeChild( toReplace );
</span><span class="lines">@@ -1034,7 +1044,7 @@
</span><span class="cx">                  if ( matchedSection && matchedSection[1] ) {
</span><span class="cx">                          settings = $('#'+matchedSection[1]);
</span><span class="cx">                          item = settings.parent();
</span><del>-                               if( 0 != item.length ) {
</del><ins>+                                if( 0 !== item.length ) {
</ins><span class="cx">                                   if( item.hasClass('menu-item-edit-inactive') ) {
</span><span class="cx">                                          if( ! settings.data('menu-item-data') ) {
</span><span class="cx">                                                  settings.data( 'menu-item-data', settings.getItemData() );
</span><span class="lines">@@ -1060,7 +1070,7 @@
</span><span class="cx">                  return false;
</span><span class="cx">          },
</span><span class="cx"> 
</span><del>-               eventOnClickMenuSave : function(clickedEl) {
</del><ins>+                eventOnClickMenuSave : function() {
</ins><span class="cx">                   var locs = '',
</span><span class="cx">                  menuName = $('#menu-name'),
</span><span class="cx">                  menuNameVal = menuName.val();
</span><span class="lines">@@ -1081,9 +1091,9 @@
</span><span class="cx">                  return true;
</span><span class="cx">          },
</span><span class="cx"> 
</span><del>-               eventOnClickMenuDelete : function(clickedEl) {
</del><ins>+                eventOnClickMenuDelete : function() {
</ins><span class="cx">                   // Delete warning AYS
</span><del>-                       if ( confirm( navMenuL10n.warnDeleteMenu ) ) {
</del><ins>+                        if ( window.confirm( navMenuL10n.warnDeleteMenu ) ) {
</ins><span class="cx">                           window.onbeforeunload = null;
</span><span class="cx">                          return true;
</span><span class="cx">                  }
</span><span class="lines">@@ -1108,7 +1118,7 @@
</span><span class="cx">                  var matched, newID,
</span><span class="cx">                  takenIDs = {},
</span><span class="cx">                  form = document.getElementById('nav-menu-meta'),
</span><del>-                       pattern = new RegExp('menu-item\\[(\[^\\]\]*)', 'g'),
</del><ins>+                        pattern = /menu-item[(\[^]\]*/,
</ins><span class="cx">                   $items = $('<div>').html(resp).find('li'),
</span><span class="cx">                  $item;
</span><span class="cx"> 
</span><span class="lines">@@ -1154,7 +1164,7 @@
</span><span class="cx">                                  var ins = $('#menu-instructions');
</span><span class="cx">                                  el.remove();
</span><span class="cx">                                  children.shiftDepthClass( -1 ).updateParentMenuItemDBId();
</span><del>-                                       if( 0 == $( '#menu-to-edit li' ).length ) {
</del><ins>+                                        if ( 0 === $( '#menu-to-edit li' ).length ) {
</ins><span class="cx">                                           $( '.drag-instructions' ).hide();
</span><span class="cx">                                          ins.removeClass( 'menu-instructions-inactive' );
</span><span class="cx">                                  }
</span></span></pre>
</div>
</div>

</body>
</html>