jenkins-bot has submitted this change and it was merged.

Change subject: Hygiene: optional arguments, jQuery selectors, hasOwnProperty 
and other fixes
......................................................................


Hygiene: optional arguments, jQuery selectors, hasOwnProperty and other fixes

* Mark optional arguments. The force parameter is not in used in
  Overlay.js but is used in OverlayManager and other places. This part
  needs more work in a follow up patch.
* Fix inefficient jQuery selectors. Selecting by ID is faster (native to
  browser) compared to the Sizzle selector engine.
* Use hasOwnProperty to filter out inherited properties
* Make 'this' unambiguous
* Wrap long lines

Change-Id: Ib728ec4ee680643634688db1e8512a23597855a1
---
M javascripts/Drawer.js
M javascripts/Overlay.js
M javascripts/api.js
M javascripts/browser.js
M javascripts/icons.js
M javascripts/mainmenu.js
6 files changed, 17 insertions(+), 12 deletions(-)

Approvals:
  Phuedx: Looks good to me, approved
  jenkins-bot: Verified

Objections:
  Jdlrobson: There's a problem with this change, please improve



diff --git a/javascripts/Drawer.js b/javascripts/Drawer.js
index f3a0ec5..eaf229e 100644
--- a/javascripts/Drawer.js
+++ b/javascripts/Drawer.js
@@ -36,7 +36,8 @@
                                $( '#mw-mf-page-center' ).off( '.drawer' );
                        } );
 
-                       // Allow the drawer itself to be clickable (e.g. for 
copying and pasting references / clicking links in reference)
+                       // Allow the drawer itself to be clickable (e.g. for 
copying and pasting references /
+                       // clicking links in reference)
                        this.$el.on( 'click', function ( ev ) {
                                ev.stopPropagation();
                        } );
diff --git a/javascripts/Overlay.js b/javascripts/Overlay.js
index b9ff409..0ef27b4 100644
--- a/javascripts/Overlay.js
+++ b/javascripts/Overlay.js
@@ -169,7 +169,7 @@
                /**
                 * Detach the overlay from the current view
                 * @method
-                * @param {Boolean} force Whether the overlay should be closed 
regardless of
+                * @param {Boolean} [force] Whether the overlay should be 
closed regardless of
                 * state (see PhotoUploadProgress)
                 * @return {Boolean} Whether the overlay was successfully 
hidden or not
                 */
@@ -236,7 +236,7 @@
                                                        var keyboardHeight = 0;
 
                                                        // detect virtual 
keyboard height
-                                                       if ( !this.isIos8 ) {
+                                                       if ( !self.isIos8 ) {
                                                                // this method 
does not work in iOS 8.02
                                                                
$window.scrollTop( 999 );
                                                                keyboardHeight 
= $window.scrollTop();
diff --git a/javascripts/api.js b/javascripts/api.js
index 04621d5..dc40f61 100644
--- a/javascripts/api.js
+++ b/javascripts/api.js
@@ -62,10 +62,12 @@
 
                        if ( typeof data !== 'string' ) {
                                for ( key in data ) {
-                                       if ( data[key] === false ) {
-                                               delete data[key];
-                                       } else if ( $.isArray( data[key] ) ) {
-                                               data[key] = data[key].join( '|' 
);
+                                       if ( data.hasOwnProperty( key ) ) {
+                                               if ( data[key] === false ) {
+                                                       delete data[key];
+                                               } else if ( $.isArray( 
data[key] ) ) {
+                                                       data[key] = 
data[key].join( '|' );
+                                               }
                                        }
                                }
                        }
diff --git a/javascripts/browser.js b/javascripts/browser.js
index 8110ccd..66141be 100644
--- a/javascripts/browser.js
+++ b/javascripts/browser.js
@@ -143,9 +143,11 @@
                        $iframe.appendTo( 'body' ).contents().find( 'body' 
).append( el );
 
                        for ( t in transforms ) {
-                               if ( el.style[t] !== undefined ) {
-                                       el.style[t] = 
'translate3d(1px,1px,1px)';
-                                       has3d = window.getComputedStyle( el 
).getPropertyValue( transforms[t] );
+                               if ( transforms.hasOwnProperty( t ) ) {
+                                       if ( el.style[t] !== undefined ) {
+                                               el.style[t] = 
'translate3d(1px,1px,1px)';
+                                               has3d = 
window.getComputedStyle( el ).getPropertyValue( transforms[t] );
+                                       }
                                }
                        }
 
diff --git a/javascripts/icons.js b/javascripts/icons.js
index fb784df..14bbb8b 100644
--- a/javascripts/icons.js
+++ b/javascripts/icons.js
@@ -21,7 +21,7 @@
                 * The icon should be used to inform the user that the 
front-end is
                 * communicating with the back-end.
                 *
-                * @param {Object} options See `Icon` for more details
+                * @param {Object} [options] See `Icon` for more details
                 * @return {Icon}
                 */
                spinner: function ( options ) {
diff --git a/javascripts/mainmenu.js b/javascripts/mainmenu.js
index 5e96f9d..96bee7b 100644
--- a/javascripts/mainmenu.js
+++ b/javascripts/mainmenu.js
@@ -58,7 +58,7 @@
 
                $( '<div class="transparent-shield cloaked-element">' 
).appendTo( '#mw-mf-page-center' );
                if ( !browser.supportsGeoLocation() ) {
-                       $( '#mw-mf-page-left .nearby' ).parent().remove();
+                       $( '#mw-mf-page-left' ).find( '.nearby' 
).parent().remove();
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/183703
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib728ec4ee680643634688db1e8512a23597855a1
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to