WordPress.org

Plugin Directory

Changeset 635885


Ignore:
Timestamp:
12/08/12 18:31:08 (16 months ago)
Author:
cfinke
Message:

Photon, Infinite Scroll: JavaScript fixes to ensure compatibility with WordPress 3.2.

WordPress 3.2 shipped with jQuery 1.6, which didn't yet have .on().

In newer versions of WordPress (and jQuery), .bind() and .delegate() are just passthrus to .on().

Location:
jetpack/trunk/modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/infinite-scroll/infinity.js

    r634666 r635885  
    6969    } else if ( type == 'click' ) { 
    7070        this.element.append( self.handle ); 
    71         this.element.on( 'click.infinity', '#infinite-handle', function() { 
     71        this.element.delegate( '#infinite-handle', 'click.infinity', function() { 
    7272            // Handle the handle 
    7373            $( '#infinite-handle' ).remove(); 
     
    125125 
    126126    // Scroll to top on blog title 
    127     blog.on( 'click', function( e ) { 
     127    blog.bind( 'click', function( e ) { 
    128128        $( 'html, body' ).animate( { scrollTop: 0 }, 'fast' ); 
    129129        e.preventDefault(); 
     
    313313 
    314314        if ( postsHeight === 0 ) { 
    315             self.body.off( 'post-load', self.checkViewportOnLoad ); 
     315            self.body.unbind( 'post-load', self.checkViewportOnLoad ); 
    316316            return; 
    317317        } 
     
    335335    } 
    336336    else { 
    337         self.body.off( 'post-load', self.checkViewportOnLoad ); 
     337        self.body.unbind( 'post-load', self.checkViewportOnLoad ); 
    338338    } 
    339339} 
  • jetpack/trunk/modules/photon/photon.js

    r635143 r635885  
    3030     */ 
    3131    $( document ).ready( restore_dims ); 
    32     $( document.body ).on( 'post-load', restore_dims ); 
     32 
     33    if ( "on" in $.fn ) 
     34        $( document.body ).on( 'post-load', restore_dims ); 
     35    else 
     36        $( document ).delegate( 'body', 'post-load', restore_dims ); 
    3337})(jQuery); 
Note: See TracChangeset for help on using the changeset viewer.