Author: rbaxter85
Date: Fri Oct 28 16:48:50 2011
New Revision: 1190438
URL: http://svn.apache.org/viewvc?rev=1190438&view=rev
Log:
SHINDIG-1652
Committed for Jason Chiang
Selection Service doesn't work correctly in IE8
Modified:
shindig/trunk/features/src/main/javascript/features/selection/selection.js
shindig/trunk/features/src/main/javascript/features/selection/selection_container.js
Modified:
shindig/trunk/features/src/main/javascript/features/selection/selection.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/selection/selection.js?rev=1190438&r1=1190437&r2=1190438&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/selection/selection.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/selection/selection.js
Fri Oct 28 16:48:50 2011
@@ -62,9 +62,9 @@ gadgets['selection'] = function() {
if (selectionChangedFunc == null) {
selectionChangedFunc = function(selection) {
currentSelection = selection;
- listeners.forEach(function(listener) {
- listener(selection);
- });
+ for (var i=0, currentListener; currentListener=listeners[i]; i++) {
+ listeners[i](selection);
+ }
};
gadgets.rpc.call('..', 'gadgets.selection', null, 'add',
selectionChangedFunc);
@@ -77,9 +77,11 @@ gadgets['selection'] = function() {
* @param {function} listener The listener to remove.
*/
removeListener: function(listener) {
- var index = listeners.indexOf(listener);
- if (index != -1) {
- listeners.splice(index, 1);
+ for (var i = 0, currentListener; currentListener=listeners[i]; i++) {
+ if (currentListener === listener) {
+ listeners.splice(i, 1);
+ break;
+ }
}
}
};
Modified:
shindig/trunk/features/src/main/javascript/features/selection/selection_container.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/selection/selection_container.js?rev=1190438&r1=1190437&r2=1190438&view=diff
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/selection/selection_container.js
(original)
+++
shindig/trunk/features/src/main/javascript/features/selection/selection_container.js
Fri Oct 28 16:48:50 2011
@@ -32,9 +32,9 @@
function notifySelection(selection) {
_selection = selection;
- listeners.forEach(function(listener) {
- listener(selection);
- });
+ for(var i=0, currentListener; currentListener=listeners[i]; i++) {
+ listeners[i](selection);
+ }
}
function addSelectionListener(listener) {
@@ -44,9 +44,11 @@
}
function removeSelectionListener(listener) {
- var index = listeners.indexOf(listener);
- if (index != -1) {
- listeners.splice(index, 1);
+ for (var i = 0, currentListener; currentListener=listeners[i]; i++) {
+ if (currentListener === listener) {
+ listeners.splice(i, 1);
+ break;
+ }
}
}