[10/47] incubator-weex git commit: * [html5] add event manager to delegate events.
* [html5] add event manager to delegate events. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2504db58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2504db58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2504db58 Branch: refs/heads/master Commit: 2504db58d113ae7964d07c934c4fa745b05c2f0c Parents: 52b0497 Author: MrRaindrop Authored: Thu Aug 24 14:52:22 2017 +0800 Committer: MrRaindrop Committed: Thu Aug 24 14:52:22 2017 +0800 -- html5/render/vue/components/a.js| 19 +-- html5/render/vue/components/div.js | 4 +- html5/render/vue/components/input.js| 7 +- html5/render/vue/components/scrollable/cell.js | 3 +- .../render/vue/components/scrollable/header.js | 5 +- html5/render/vue/components/scrollable/list.js | 2 +- .../components/scrollable/mixins/scrollable.js | 6 - .../vue/components/scrollable/scroller.js | 2 +- .../vue/components/scrollable/waterfall.js | 2 +- html5/render/vue/components/slider/index.js | 2 + html5/render/vue/config.js | 3 +- html5/render/vue/core/node.js | 117 ++- html5/render/vue/env/event-manager.js | 148 +++ html5/render/vue/index.js | 4 + html5/render/vue/lib/gesture.js | 2 +- html5/render/vue/utils/event.js | 16 ++ 16 files changed, 195 insertions(+), 147 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/a.js -- diff --git a/html5/render/vue/components/a.js b/html5/render/vue/components/a.js index 1d8946f..ff4a59d 100644 --- a/html5/render/vue/components/a.js +++ b/html5/render/vue/components/a.js @@ -28,8 +28,7 @@ let cnt = 0 function getA (weex) { const { extractComponentStyle, -trimTextVNodes, -createEventMap +trimTextVNodes } = weex return { @@ -37,21 +36,6 @@ function getA (weex) { props: { href: String }, -mounted () { - const $el = this.$el - const id = $el.id - - /** - * if there is a child component already triggered a click handler, then - * this link jumping should be prevented. - */ - $el.addEventListener('click', (e) => { -const el = e._triggered && e._triggered.el -if (el && (el !== $el) && !el.querySelector(`#${id}`)) { - e.preventDefault() -} - }) -}, render (createElement) { /* istanbul ignore next */ // if (process.env.NODE_ENV === 'development') { @@ -64,7 +48,6 @@ function getA (weex) { 'id': `weex-a-${id}`, href: this.href }, -on: createEventMap(this), staticClass: 'weex-a weex-ct', staticStyle: extractComponentStyle(this) }, trimTextVNodes(this.$slots.default)) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/div.js -- diff --git a/html5/render/vue/components/div.js b/html5/render/vue/components/div.js index 8f05163..8b29a70 100644 --- a/html5/render/vue/components/div.js +++ b/html5/render/vue/components/div.js @@ -26,8 +26,7 @@ body > .weex-div { function getDiv (weex) { const { extractComponentStyle, -trimTextVNodes, -createEventMap +trimTextVNodes } = weex return { @@ -35,7 +34,6 @@ function getDiv (weex) { render (createElement) { return createElement('html:div', { attrs: { 'weex-type': 'div' }, -on: createEventMap(this), staticClass: 'weex-div weex-ct', staticStyle: extractComponentStyle(this) }, trimTextVNodes(this.$slots.default)) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/input.js -- diff --git a/html5/render/vue/components/input.js b/html5/render/vue/components/input.js index 0e8d466..b9d403d 100644 --- a/html5/render/vue/components/input.js +++ b/html5/render/vue/components/input.js @@ -21,8 +21,7 @@ * @fileOverview Input component. * Support v-model only if vue version is large than 2.2.0 */ -let extractComponentStyle, createEventMap -let extend, mapFormEvents, appendCss +let extractComponentStyle, mapFormEvents, appendCss const ID_PREFIX_PLACEHOLDER_COLOR = 'wipt_plc_' const ID_PREFIX_INPUT = 'wipt_' @@ -104,7 +103,7 @@ function getInput (weex) { if (!this._id) { this._id = idCount++ } - const events = extend(createEventMap(this), mapFormEvents(this)) + con
[10/47] incubator-weex git commit: * [html5] add event manager to delegate events.
* [html5] add event manager to delegate events. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2504db58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2504db58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2504db58 Branch: refs/heads/dev Commit: 2504db58d113ae7964d07c934c4fa745b05c2f0c Parents: 52b0497 Author: MrRaindrop Authored: Thu Aug 24 14:52:22 2017 +0800 Committer: MrRaindrop Committed: Thu Aug 24 14:52:22 2017 +0800 -- html5/render/vue/components/a.js| 19 +-- html5/render/vue/components/div.js | 4 +- html5/render/vue/components/input.js| 7 +- html5/render/vue/components/scrollable/cell.js | 3 +- .../render/vue/components/scrollable/header.js | 5 +- html5/render/vue/components/scrollable/list.js | 2 +- .../components/scrollable/mixins/scrollable.js | 6 - .../vue/components/scrollable/scroller.js | 2 +- .../vue/components/scrollable/waterfall.js | 2 +- html5/render/vue/components/slider/index.js | 2 + html5/render/vue/config.js | 3 +- html5/render/vue/core/node.js | 117 ++- html5/render/vue/env/event-manager.js | 148 +++ html5/render/vue/index.js | 4 + html5/render/vue/lib/gesture.js | 2 +- html5/render/vue/utils/event.js | 16 ++ 16 files changed, 195 insertions(+), 147 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/a.js -- diff --git a/html5/render/vue/components/a.js b/html5/render/vue/components/a.js index 1d8946f..ff4a59d 100644 --- a/html5/render/vue/components/a.js +++ b/html5/render/vue/components/a.js @@ -28,8 +28,7 @@ let cnt = 0 function getA (weex) { const { extractComponentStyle, -trimTextVNodes, -createEventMap +trimTextVNodes } = weex return { @@ -37,21 +36,6 @@ function getA (weex) { props: { href: String }, -mounted () { - const $el = this.$el - const id = $el.id - - /** - * if there is a child component already triggered a click handler, then - * this link jumping should be prevented. - */ - $el.addEventListener('click', (e) => { -const el = e._triggered && e._triggered.el -if (el && (el !== $el) && !el.querySelector(`#${id}`)) { - e.preventDefault() -} - }) -}, render (createElement) { /* istanbul ignore next */ // if (process.env.NODE_ENV === 'development') { @@ -64,7 +48,6 @@ function getA (weex) { 'id': `weex-a-${id}`, href: this.href }, -on: createEventMap(this), staticClass: 'weex-a weex-ct', staticStyle: extractComponentStyle(this) }, trimTextVNodes(this.$slots.default)) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/div.js -- diff --git a/html5/render/vue/components/div.js b/html5/render/vue/components/div.js index 8f05163..8b29a70 100644 --- a/html5/render/vue/components/div.js +++ b/html5/render/vue/components/div.js @@ -26,8 +26,7 @@ body > .weex-div { function getDiv (weex) { const { extractComponentStyle, -trimTextVNodes, -createEventMap +trimTextVNodes } = weex return { @@ -35,7 +34,6 @@ function getDiv (weex) { render (createElement) { return createElement('html:div', { attrs: { 'weex-type': 'div' }, -on: createEventMap(this), staticClass: 'weex-div weex-ct', staticStyle: extractComponentStyle(this) }, trimTextVNodes(this.$slots.default)) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2504db58/html5/render/vue/components/input.js -- diff --git a/html5/render/vue/components/input.js b/html5/render/vue/components/input.js index 0e8d466..b9d403d 100644 --- a/html5/render/vue/components/input.js +++ b/html5/render/vue/components/input.js @@ -21,8 +21,7 @@ * @fileOverview Input component. * Support v-model only if vue version is large than 2.2.0 */ -let extractComponentStyle, createEventMap -let extend, mapFormEvents, appendCss +let extractComponentStyle, mapFormEvents, appendCss const ID_PREFIX_PLACEHOLDER_COLOR = 'wipt_plc_' const ID_PREFIX_INPUT = 'wipt_' @@ -104,7 +103,7 @@ function getInput (weex) { if (!this._id) { this._id = idCount++ } - const events = extend(createEventMap(this), mapFormEvents(this)) + const