Skip to content

Commit 5f6e0a3

Browse files
committed
rm nativeEvents binding & fix typeof of stopOuterA.
1 parent 6b9b011 commit 5f6e0a3

File tree

10 files changed

+10
-65
lines changed

10 files changed

+10
-65
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weex-vue-precompiler",
3-
"version": "0.1.14",
3+
"version": "0.1.15",
44
"description": "a precompiler for weex-vue-render.",
55
"main": "src/index.js",
66
"scripts": {

src/hooks/events.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ module.exports = function eventsHook (
8989

9090
const { weexEvents } = this.config
9191
let evts = el.events
92-
// bind events to nativeEvents.
93-
el.nativeEvents = evts
92+
// bind events to events and remove nativeEvents.
93+
delete el.nativeEvents
9494

9595
if (evts) {
9696
const evtKeys = Object.keys(evts)
@@ -138,7 +138,7 @@ module.exports = function eventsHook (
138138
evts['weex$tap'] = extend({}, evts.click)
139139
if (!hasBubbleParent) {
140140
evts.click = {
141-
value: '$stopOutterA'
141+
value: '$stopOuterA'
142142
}
143143
}
144144
}
@@ -154,7 +154,7 @@ module.exports = function eventsHook (
154154
*/
155155
if (el.tag === 'a') {
156156
if (!evts) {
157-
evts = el.events = el.nativeEvents = {}
157+
evts = el.events = {}
158158
}
159159
if (!checkBubble(el)) {
160160
const evt = evts['weex$tap']

src/util/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ exports.extend = function (to, from) {
55
const args = Array.prototype.slice.call(arguments, 1)
66
for (let i = 0, l = args.length; i < l; i++) {
77
const from = args[i]
8+
if (!from) { continue }
89
for (const k in from) {
910
if (from.hasOwnProperty(k)) {
1011
to[k] = from[k]

test/output/components/a.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ module.exports = [
33
type: 1,
44
tag: 'a',
55
_hasBubbleParent: false,
6-
nativeEvents: {
7-
'weex$tap': {
8-
value: '$stopPropagation'
9-
}
10-
},
116
events: {
127
'weex$tap': {
138
value: '$stopPropagation'
@@ -28,7 +23,6 @@ module.exports = [
2823
}, {
2924
type: 1,
3025
tag: 'div',
31-
nativeEvents: undefined,
3226
plain: false,
3327
attrs: [
3428
{

test/output/components/cell.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = [
44
tag: 'section',
55
_origTag: 'cell',
66
plain: false,
7-
nativeEvents: undefined,
87
static: false,
98
attrs: [
109
{

test/output/components/image.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = [
33
type: 1,
44
tag: 'figure',
55
_origTag: 'image',
6-
nativeEvents: undefined,
76
plain: false,
87
hasBindings: true,
98
attrs: [
@@ -37,7 +36,6 @@ module.exports = [
3736
}, {
3837
type: 1,
3938
tag: 'div',
40-
nativeEvents: undefined,
4139
plain: false,
4240
attrs: [
4341
{

test/output/components/text.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = [
55
type: 1,
66
tag: 'p',
77
_origTag: 'text',
8-
nativeEvents: undefined,
98
plain: false,
109
attrs: [
1110
{
@@ -26,7 +25,6 @@ module.exports = [
2625
}, {
2726
type: 1,
2827
tag: 'div',
29-
nativeEvents: undefined,
3028
plain: false,
3129
attrs: [
3230
{

test/output/hooks/a-bubble.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,7 @@ module.exports = [
1515
}
1616
},
1717
click: {
18-
value: '$stopOutterA'
19-
}
20-
},
21-
nativeEvents: {
22-
weex$tap: {
23-
value: 'innerClick',
24-
modifiers: {
25-
stop: true
26-
}
27-
},
28-
click: {
29-
value: '$stopOutterA'
18+
value: '$stopOuterA'
3019
}
3120
},
3221
attrs: [
@@ -44,11 +33,6 @@ module.exports = [
4433
type: 1,
4534
tag: 'a',
4635
_hasBubbleParent: false,
47-
nativeEvents: {
48-
'weex$tap': {
49-
value: '$stopPropagation'
50-
}
51-
},
5236
events: {
5337
'weex$tap': {
5438
value: '$stopPropagation'
@@ -79,18 +63,7 @@ module.exports = [
7963
}
8064
},
8165
click: {
82-
value: '$stopOutterA'
83-
}
84-
},
85-
nativeEvents: {
86-
weex$tap: {
87-
value: 'outerClick',
88-
modifiers: {
89-
stop: true
90-
}
91-
},
92-
click: {
93-
value: '$stopOutterA'
66+
value: '$stopOuterA'
9467
}
9568
},
9669
plain: false,

test/output/hooks/events.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,7 @@ module.exports = [
1919
}
2020
},
2121
click: {
22-
value: '$stopOutterA'
23-
}
24-
},
25-
nativeEvents: {
26-
appear: {
27-
value: 'appear',
28-
modifiers: {
29-
stop: true
30-
}
31-
},
32-
weex$tap: {
33-
value: 'click',
34-
modifiers: {
35-
stop: true
36-
}
37-
},
38-
click: {
39-
value: '$stopOutterA'
22+
value: '$stopOuterA'
4023
}
4124
},
4225
attrs: [
@@ -59,7 +42,6 @@ module.exports = [
5942
}, {
6043
type: 1,
6144
tag: 'div',
62-
nativeEvents: undefined,
6345
plain: false,
6446
attrs: [
6547
{

0 commit comments

Comments
 (0)