From bdc1c2879a366e33caee3554cb6a3a27581de720 Mon Sep 17 00:00:00 2001 From: Stefan Billiet Date: Mon, 18 May 2015 09:51:47 +0200 Subject: [PATCH] Fix for issue 175 Squashed commit of the following: commit 4c02e04468d83ca75fa5368930c9f6f8c8c5d125 Merge: 8183305 3da945f Author: Stefan Billiet Date: Tue May 12 13:08:49 2015 +0200 Merge branch 'issue175' of https://github.com/StefanBilliet/react-select into issue175 commit 818330572f7a5ed25a6d14ca61b94db33fc6e37b Author: Stefan Billiet Date: Tue May 12 13:05:59 2015 +0200 Added es5-shim & es5-sham to the examples page, so that this issue can be tested under IE8 commit 3da945f5a7362d0472148a07ae9c0b8d701c112e Author: Stefan Billiet Date: Tue May 12 13:05:59 2015 +0200 Added es5-shim & es5-sham to the examples page, so that this PR can be tested under IE8 commit c1054b1c51d8a241fc76584174af9ab0108e1cbc Author: sbillietcsc Date: Tue May 12 12:40:16 2015 +0200 Fixed missing semi-colons commit cf53043878d91b9cf246c79ee9e6085b20dd2887 Merge: f0b0048 25c77bd Author: Stefan Billiet Date: Tue May 12 12:31:57 2015 +0200 Merge branch 'master' of https://github.com/JedWatson/react-select into issue175 Conflicts: src/Select.js commit f0b004833b9f5a7545773425f36d28e4eea84ef5 Author: Stefan Billiet Date: Thu May 7 17:47:24 2015 +0200 Adding support for IE8 in _bindCloseMenuIfClickedOutside and _unbindCloseMenuIfClickedOutside --- examples/src/index.html | 4 +++- src/Select.js | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/src/index.html b/examples/src/index.html index 7a82163278..ef73bc923f 100644 --- a/examples/src/index.html +++ b/examples/src/index.html @@ -37,7 +37,9 @@

Examples:

- + + + diff --git a/src/Select.js b/src/Select.js index ba943ac87c..7d83d02461 100644 --- a/src/Select.js +++ b/src/Select.js @@ -119,11 +119,19 @@ var Select = React.createClass({ }; this._bindCloseMenuIfClickedOutside = function() { - document.addEventListener('click', self._closeMenuIfClickedOutside); + if (!document.addEventListener && document.attachEvent) { + document.attachEvent('onclick', this._closeMenuIfClickedOutside); + } else { + document.addEventListener('click', this._closeMenuIfClickedOutside); + } }; this._unbindCloseMenuIfClickedOutside = function() { - document.removeEventListener('click', self._closeMenuIfClickedOutside); + if (!document.removeEventListener && document.detachEvent) { + document.detachEvent('onclick', this._closeMenuIfClickedOutside); + } else { + document.removeEventListener('click', this._closeMenuIfClickedOutside); + } }; },