[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Fix for 8df2a56560ee, 2a9d716e68f8

2017-03-31 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
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(-)

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



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: merged
Gerrit-Change-Id: I6ec476c364122649f1c7f791f0dd521a41d21290
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: Yaron Koren 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Fix for 8df2a56560ee, 2a9d716e68f8

2017-03-31 Thread Yaron Koren (Code Review)
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 

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