From 192f150bc2ae5374ca3f14965abfb0aba4365ead Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 18 Aug 2015 16:21:56 +0800 Subject: [PATCH] use rc-util addEventListener --- components/modal/eventListener.js | 14 -------------- components/modal/index.jsx | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 components/modal/eventListener.js diff --git a/components/modal/eventListener.js b/components/modal/eventListener.js deleted file mode 100644 index 90f79085b8..0000000000 --- a/components/modal/eventListener.js +++ /dev/null @@ -1,14 +0,0 @@ -function wrap(standard, fallback) { - return function (el, evtName, listener, useCapture) { - if (el[standard]) { - el[standard](evtName, listener, useCapture); - } else if (el[fallback]) { - el[fallback]('on' + evtName, listener); - } - }; -} - -export default { - add: wrap('addEventListener', 'attachEvent'), - remove: wrap('removeEventListener', 'detachEvent') -}; diff --git a/components/modal/index.jsx b/components/modal/index.jsx index c0f4be204e..681561dc8c 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -1,6 +1,6 @@ import React from 'react'; import Dialog from 'rc-dialog'; -import eventListener from './eventListener'; +import { Dom } from 'rc-util'; function noop() { } @@ -12,7 +12,7 @@ function onDocumentMousemove(e) { }; } -eventListener.add(document, 'mousemove', onDocumentMousemove); +Dom.addEventListener(document, 'mousemove', onDocumentMousemove); export default React.createClass({ getDefaultProps() {