r79495 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79494‎ | r79495 | r79496 >
Date:17:57, 2 January 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
bugfix: initialisation was executed twice for "multiple" forms
Modified paths:
  • /trunk/extensions/SemanticForms/libs/SemanticForms.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/libs/SemanticForms.js
@@ -261,7 +261,8 @@
262262 //
263263 // @param inifunction The initialisation functions. Must take a string (the input's id) and an object as parameters
264264 // @param param The parameter object given to the initialisation function
265 -jQuery.fn.registerInitialisation = function( inifunction, param ) {
 265+// @param noexecute If set, the initialisation method will not be executed here
 266+jQuery.fn.registerInitialisation = function( inifunction, param, noexecute ) {
266267
267268 // return if element has no id
268269 if ( ! this.attr("id") ) return this;
@@ -283,7 +284,8 @@
284285 });
285286
286287 // execute initialisation if input is not part of multipleTemplateStarter
287 - if ( this.closest(".multipleTemplateStarter").length == 0 ) {
 288+ // and if not forbidden
 289+ if ( this.closest(".multipleTemplateStarter").length == 0 && !noexecute) {
288290 var input = this;
289291 // ensure inifunction is only exectued after doc structure is complete
290292 jQuery(function(){inifunction ( input.attr("id"), param )});
@@ -628,7 +630,8 @@
629631 // take initialisation method and register for new input
630632 jQuery(this).registerInitialisation(
631633 sfdata.initialisation[old_id][i].inifunction,
632 - sfdata.initialisation[old_id][i].parameters
 634+ sfdata.initialisation[old_id][i].parameters,
 635+ true //do not yet execute
633636 );
634637 }
635638

Status & tagging log