Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345920 )

Change subject: Fix for 8df2a56560ee, 2a9d716e68f8
......................................................................

Fix for 8df2a56560ee, 2a9d716e68f8

Object.values() is only supported on Chrome and Firefox.

Change-Id: I6ec476c364122649f1c7f791f0dd521a41d21290
---
M libs/PageForms.js
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms 
refs/changes/20/345920/2

diff --git a/libs/PageForms.js b/libs/PageForms.js
index 598b6a5..ef92d22 100644
--- a/libs/PageForms.js
+++ b/libs/PageForms.js
@@ -95,8 +95,14 @@
                                }
                                // This may be an associative array instead of a
                                // regular one - grep() requires a regular one.
+                               // (Is this "if" check necessary, or useful?)
                                if ( typeof array === 'object' ) {
                                        array = Object.values( array );
+                                       // Unfortunately, Object.values() is
+                                       // not supported on all browsers.
+                                       array = 
Object.keys(array).map(function(key) {
+                                               return array[key];
+                                       });
                                }
                                return $.grep( array, function(value) {
                                        return matcher.test( value.label || 
value.value || value );
@@ -154,7 +160,9 @@
                        } else {
                                // Autocomplete for a single value
                                $(this).autocomplete({
-                                       source: ( typeof values === 'object' ) 
? Object.values( values ) : values
+                                       // Unfortunately, Object.values() is
+                                       // not supported on all browsers.
+                                       source: ( typeof values === 'object' ) 
? Object.keys(values).map(function(key) { return values[key]; }) : values
                                });
                        }
                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ec476c364122649f1c7f791f0dd521a41d21290
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to