r78965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78964‎ | r78965 | r78966 >
Date:15:24, 24 December 2010
Author:krinkle
Status:ok
Tags:
Comment:
Forgot to namespace the click handler. Unbinding all click handlers is indeed risky (Follow-up r78935 CR)
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.makeCollapsible.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.makeCollapsible.js
@@ -83,7 +83,7 @@
8484 }
8585
8686 // Create toggle link with a space around the brackets ( [text] )
87 - var $toggleLink = $( '<a href="#">' ).text( collapsetext ).wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-expanded">' ).parent().prepend( '&nbsp;[' ).append( ']&nbsp;' ).click( function(e){
 87+ var $toggleLink = $( '<a href="#">' ).text( collapsetext ).wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-expanded">' ).parent().prepend( '&nbsp;[' ).append( ']&nbsp;' ).bind( 'click.mw-collapse', function(e){
8888 e.preventDefault();
8989 toggleFunction( this );
9090 } );
@@ -104,7 +104,7 @@
105105 if ( !$toggle.size() ) {
106106 $lastCell.prepend( $toggleLink );
107107 } else {
108 - $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
 108+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
109109 e.preventDefault();
110110 toggleFunction( this );
111111 } );
@@ -122,7 +122,7 @@
123123 }
124124 $that.prepend( $toggleLink.wrap( '<li class="mw-collapsibile-toggle-li">' ).parent() );
125125 } else {
126 - $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
 126+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
127127 e.preventDefault();
128128 toggleFunction( this );
129129 } );
@@ -141,7 +141,7 @@
142142 if ( !$toggle.size() ) {
143143 $that.prepend( $toggleLink );
144144 } else {
145 - $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
 145+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
146146 e.preventDefault();
147147 toggleFunction( this );
148148 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78935Improving jquery.makeCollapsible:...krinkle23:34, 23 December 2010
r78944Fixing TODO from r78915...krinkle01:30, 24 December 2010

Status & tagging log