You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/07/20 08:29:57 UTC

[27/50] incubator-weex git commit: * [html5] fix phantomjs don't support customer event bug

* [html5]  fix phantomjs don't  support customer event bug


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/92bf1d3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/92bf1d3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/92bf1d3b

Branch: refs/heads/0.15-dev
Commit: 92bf1d3bd968c5a2acfb83de56f490026ad5a0a1
Parents: 1a77685
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:52:32 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:52:32 2017 +0800

----------------------------------------------------------------------
 html5/render/vue/utils/event.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/92bf1d3b/html5/render/vue/utils/event.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/event.js b/html5/render/vue/utils/event.js
index ac84c87..94b7a94 100644
--- a/html5/render/vue/utils/event.js
+++ b/html5/render/vue/utils/event.js
@@ -39,7 +39,10 @@ export function createEvent (target, type, props) {
   // event.stopPropagation()
 
   extend(event, props)
-
+  //  phantomjs don't support customer event
+  if (window.navigator.userAgent.indexOf('PhantomJS') !== -1) {
+    return event
+  }
   try {
     Object.defineProperty(event, 'target', {
       enumerable: true,
@@ -49,7 +52,6 @@ export function createEvent (target, type, props) {
   catch (err) {
     return extend({}, event, { target: target || null })
   }
-
   return event
 }