r80754 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80753‎ | r80754 | r80755 >
Date:16:58, 22 January 2011
Author:dale
Status:deferred
Tags:
Comment:
out of order function call
Modified paths:
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -670,6 +670,32 @@
671671 }
672672
673673 /**
 674+ * Similar to php isset function checks if the variable exists. Does a safe
 675+ * check of a descendant method or variable
 676+ *
 677+ * @param {String}
 678+ * objectPath
 679+ * @return {Boolean} true if objectPath exists false if objectPath is
 680+ * undefined
 681+ */
 682+mwIsset = function( objectPath ) {
 683+ if ( !objectPath || typeof objectPath != 'string') {
 684+ return false;
 685+ }
 686+ var pathSet = objectPath.split( '.' );
 687+ var cur_path = '';
 688+
 689+ for ( var p = 0; p < pathSet.length; p++ ) {
 690+ cur_path = ( cur_path == '' ) ? cur_path + pathSet[p] : cur_path + '.' + pathSet[p];
 691+ eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
 692+ if ( ptest == 'undefined' ) {
 693+ return false;
 694+ }
 695+ }
 696+ return true;
 697+};
 698+
 699+/**
674700 * Load the mwEmbed library:
675701 *
676702 * @param {mixed} function or classSet to preload
@@ -769,32 +795,7 @@
770796 waitForJqueryUi();
771797 }
772798
773 -/**
774 - * Similar to php isset function checks if the variable exists. Does a safe
775 - * check of a descendant method or variable
776 - *
777 - * @param {String}
778 - * objectPath
779 - * @return {Boolean} true if objectPath exists false if objectPath is
780 - * undefined
781 - */
782 -mwIsset = function( objectPath ) {
783 - if ( !objectPath || typeof objectPath != 'string') {
784 - return false;
785 - }
786 - var pathSet = objectPath.split( '.' );
787 - var cur_path = '';
788799
789 - for ( var p = 0; p < pathSet.length; p++ ) {
790 - cur_path = ( cur_path == '' ) ? cur_path + pathSet[p] : cur_path + '.' + pathSet[p];
791 - eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
792 - if ( ptest == 'undefined' ) {
793 - return false;
794 - }
795 - }
796 - return true;
797 -};
798 -
799800 /**
800801 * Check if the gadget is installed
801802 * run after mwEmbed setup so $j and mw interface is available:

Status & tagging log