Changeset 36371
- Timestamp:
- 01/21/2016 06:07:45 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/customize-preview.js
r35391 r36371 34 34 api.Preview = api.Messenger.extend({ 35 35 /** 36 * @param {string} url The URL of preview frame 36 * @param {object} params - Parameters to configure the messenger. 37 * @param {object} options - Extend any instance parameter or method with this object. 37 38 */ 38 39 initialize: function( params, options ) { … … 43 44 this.body = $( document.body ); 44 45 this.body.on( 'click.preview', 'a', function( event ) { 46 var link, isInternalJumpLink; 47 link = $( this ); 48 isInternalJumpLink = ( '#' === link.attr( 'href' ).substr( 0, 1 ) ); 45 49 event.preventDefault(); 50 51 if ( isInternalJumpLink && '#' !== link.attr( 'href' ) ) { 52 $( link.attr( 'href' ) ).each( function() { 53 this.scrollIntoView(); 54 } ); 55 } 56 57 /* 58 * Note the shift key is checked so shift+click on widgets or 59 * nav menu items can just result on focusing on the corresponding 60 * control instead of also navigating to the URL linked to. 61 */ 62 if ( event.shiftKey || isInternalJumpLink ) { 63 return; 64 } 46 65 self.send( 'scroll', 0 ); 47 self.send( 'url', $(this).prop('href') );66 self.send( 'url', link.prop( 'href' ) ); 48 67 }); 49 68
Note: See TracChangeset
for help on using the changeset viewer.