<!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>[21611] trunk/wp-content/themes/twentytwelve: Twenty Twelve: rework navigation to remove need for jQuery and support wp_page_menu markup better.</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, #logmsg > ol { margin-left: 0; 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/21611">21611</a></dd>
<dt>Author</dt> <dd>lancewillett</dd>
<dt>Date</dt> <dd>2012-08-24 21:07:19 +0000 (Fri, 24 Aug 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Twenty Twelve: rework navigation to remove need for jQuery and support wp_page_menu markup better. Fixes <a href="http://core.trac.wordpress.org/ticket/21562">#21562</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpcontentthemestwentytwelvefunctionsphp">trunk/wp-content/themes/twentytwelve/functions.php</a></li>
<li><a href="#trunkwpcontentthemestwentytwelveheaderphp">trunk/wp-content/themes/twentytwelve/header.php</a></li>
<li><a href="#trunkwpcontentthemestwentytwelvejsnavigationjs">trunk/wp-content/themes/twentytwelve/js/navigation.js</a></li>
<li><a href="#trunkwpcontentthemestwentytwelvertlcss">trunk/wp-content/themes/twentytwelve/rtl.css</a></li>
<li><a href="#trunkwpcontentthemestwentytwelvestylecss">trunk/wp-content/themes/twentytwelve/style.css</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpcontentthemestwentytwelvefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentytwelve/functions.php (21610 => 21611)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentytwelve/functions.php        2012-08-24 20:50:22 UTC (rev 21610)
+++ trunk/wp-content/themes/twentytwelve/functions.php        2012-08-24 21:07:19 UTC (rev 21611)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">          * JavaScript for handling navigation menus and the resized
</span><span class="cx">          * styles for small screen sizes.
</span><span class="cx">          */
</span><del>-        wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20120820', true );
</del><ins>+        wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );
</ins><span class="cx">
</span><span class="cx">         /**
</span><span class="cx">          * Load special font CSS file.
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytwelveheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentytwelve/header.php (21610 => 21611)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentytwelve/header.php        2012-08-24 20:50:22 UTC (rev 21610)
+++ trunk/wp-content/themes/twentytwelve/header.php        2012-08-24 21:07:19 UTC (rev 21611)
</span><span class="lines">@@ -35,10 +35,10 @@
</span><span class="cx">                         <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</span><span class="cx">                 </hgroup>
</span><span class="cx">
</span><del>-                <nav class="site-navigation main-navigation" role="navigation">
</del><ins>+                <nav id="site-navigation" class="main-navigation" role="navigation">
</ins><span class="cx">                         <h3 class="menu-toggle"><?php _e( 'Show menu', 'twentytwelve' ); ?></h3>
</span><span class="cx">                         <div class="skip-link assistive-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a></div>
</span><del>-                        <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</del><ins>+                        <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</ins><span class="cx">                 </nav>
</span><span class="cx">
</span><span class="cx">                 <?php $header_image = get_header_image();
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytwelvejsnavigationjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentytwelve/js/navigation.js (21610 => 21611)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentytwelve/js/navigation.js        2012-08-24 20:50:22 UTC (rev 21610)
+++ trunk/wp-content/themes/twentytwelve/js/navigation.js        2012-08-24 21:07:19 UTC (rev 21611)
</span><span class="lines">@@ -3,14 +3,27 @@
</span><span class="cx"> *
</span><span class="cx"> * Handles toggling the navigation menu for small screens.
</span><span class="cx"> */
</span><ins>+( function() {
+ var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0],
+ menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0];
</ins><span class="cx">
</span><del>-jQuery( document ).ready( function( $ ) {
-        if ( ! $( '#masthead .menu' ).children().length ) {
-                $( '#masthead .menu-toggle' ).hide();
-        }
</del><ins>+ if ( undefined == button || undefined == menu )
+         return false;
</ins><span class="cx">
</span><del>-        $( '.menu-toggle' ).off( 'click' ).click( function() {
-                $( '#masthead .menu' ).stop().slideToggle();
-                $( this ).toggleClass( 'toggled-on' );
-        } );
-} );
</del><span class="cx">\ No newline at end of file
</span><ins>+ button.onclick = function() {
+ if ( -1 == menu.className.indexOf( 'nav-menu' ) )
+ menu.className = 'nav-menu';
+
+ if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
+ button.className = button.className.replace( ' toggled-on', '' );
+ menu.className = menu.className.replace( ' toggled-on', '' );
+ } else {
+ button.className += ' toggled-on';
+ menu.className += ' toggled-on';
+ }
+ };
+
+ // Hide menu toggle button if menu is empty.
+ if ( ! menu.childNodes.length )
+ button.style.display = 'none';
+} )();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytwelvertlcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentytwelve/rtl.css (21610 => 21611)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentytwelve/rtl.css        2012-08-24 20:50:22 UTC (rev 21610)
+++ trunk/wp-content/themes/twentytwelve/rtl.css        2012-08-24 21:07:19 UTC (rev 21611)
</span><span class="lines">@@ -55,15 +55,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-/* =Basic structure
--------------------------------------------------------------- */
-
-.main-navigation li ul ul {
-        margin-left: 0;
-        margin-right: 40px;
-        margin-right: 2.857142857rem;
-}
-
</del><span class="cx"> /* =Main Content
</span><span class="cx"> ----------------------------------------------- */
</span><span class="cx">
</span><span class="lines">@@ -220,6 +211,10 @@
</span><span class="cx">                 margin: 0 24px 0;
</span><span class="cx">                 margin: 0 1.714285714rem 0;
</span><span class="cx">         }
</span><ins>+        .main-navigation ul.nav-menu,
+         .main-navigation div.nav-menu > ul {
+                text-align: right;
+        }
</ins><span class="cx">         .main-navigation li {
</span><span class="cx">                 margin-left: 40px;
</span><span class="cx">                 margin-left: 2.857142857rem;
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytwelvestylecss"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentytwelve/style.css (21610 => 21611)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentytwelve/style.css        2012-08-24 20:50:22 UTC (rev 21610)
+++ trunk/wp-content/themes/twentytwelve/style.css        2012-08-24 21:07:19 UTC (rev 21611)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>-Theme Name: Twenty Twelve
</del><ins>+13Theme Name: Twenty Twelve
</ins><span class="cx"> Theme URI: http://wordpress.org/extend/themes/twentytwelve
</span><span class="cx"> Author: the WordPress team
</span><span class="cx"> Author URI: http://wordpress.org/
</span><span class="lines">@@ -513,10 +513,6 @@
</span><span class="cx">         margin-top: 1.714285714rem;
</span><span class="cx">         text-align: center;
</span><span class="cx"> }
</span><del>-.main-navigation li ul ul {
-        margin-left: 40px;
-        margin-left: 2.857142857rem;
-}
</del><span class="cx"> .main-navigation li {
</span><span class="cx">         margin-top: 24px;
</span><span class="cx">         margin-top: 1.714285714rem;
</span><span class="lines">@@ -531,9 +527,11 @@
</span><span class="cx"> .main-navigation a:hover {
</span><span class="cx">         color: #21759b;
</span><span class="cx"> }
</span><del>-.main-navigation .menu {
</del><ins>+.main-navigation ul.nav-menu,
+.main-navigation div.nav-menu > ul {
</ins><span class="cx">         display: none;
</span><span class="cx"> }
</span><ins>+.main-navigation ul.nav-menu.toggled-on,
</ins><span class="cx"> .menu-toggle {
</span><span class="cx">         display: inline-block;
</span><span class="cx"> }
</span><span class="lines">@@ -1340,7 +1338,8 @@
</span><span class="cx">                 font-size: 1.857142857rem;
</span><span class="cx">                 line-height: 1.846153846;
</span><span class="cx">         }
</span><del>-        .main-navigation .menu {
</del><ins>+        .main-navigation ul.nav-menu,
+         .main-navigation div.nav-menu > ul {
</ins><span class="cx">                 border-bottom: 1px solid #ededed;
</span><span class="cx">                 border-top: 1px solid #ededed;
</span><span class="cx">                 display: inline-block !important;
</span><span class="lines">@@ -1353,16 +1352,15 @@
</span><span class="cx">                 margin: 0;
</span><span class="cx">                 text-indent: 0;
</span><span class="cx">         }
</span><del>-        .main-navigation li ul li {
-                padding-left: 0;
-        }
</del><span class="cx">         .main-navigation li a,
</span><span class="cx">         .main-navigation li {
</span><span class="cx">                 display: inline-block;
</span><span class="cx">                 text-decoration: none;
</span><span class="cx">         }
</span><span class="cx">         .main-navigation li a {
</span><ins>+                border-bottom: 0;
</ins><span class="cx">                 color: #6a6a6a;
</span><ins>+                line-height: 3.692307692;
</ins><span class="cx">                 text-transform: uppercase;
</span><span class="cx">         }
</span><span class="cx">         .main-navigation li a:hover {
</span><span class="lines">@@ -1373,10 +1371,6 @@
</span><span class="cx">                 margin: 0 2.857142857rem 0 0;
</span><span class="cx">                 position: relative;
</span><span class="cx">         }
</span><del>-        .main-navigation li a {
-                border-bottom: 0;
-                line-height: 3.692307692;
-        }
</del><span class="cx">         .main-navigation li ul {
</span><span class="cx">                 display: none;
</span><span class="cx">                 margin: 0;
</span><span class="lines">@@ -1386,7 +1380,6 @@
</span><span class="cx">                 z-index: 1;
</span><span class="cx">         }
</span><span class="cx">         .main-navigation li ul ul {
</span><del>-                margin-left: 0;
</del><span class="cx">                 top: 0;
</span><span class="cx">                 left: 100%;
</span><span class="cx">         }
</span><span class="lines">@@ -1548,7 +1541,7 @@
</span><span class="cx">         .site-content nav,
</span><span class="cx">         .widget-area,
</span><span class="cx">         img.header-image,
</span><del>-        nav.site-navigation {
</del><ins>+        .main-navigation {
</ins><span class="cx">                 display: none;
</span><span class="cx">         }
</span><span class="cx">         .wrapper {
</span></span></pre>
</div>
</div>
</body>
</html>