Skip to content

Commit 41e4647

Browse files
committed
pass createElement into render functions
1 parent 6a3430d commit 41e4647

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

src/core/instance/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function renderMixin (Vue: Class<Component>) {
6969
resolveSlots(vm, _renderChildren)
7070
}
7171
// render self
72-
let vnode = render.call(vm._renderProxy)
72+
let vnode = render.call(vm._renderProxy, vm.$createElement)
7373
// return empty vnode in case the render function errored out
7474
if (!(vnode instanceof VNode)) {
7575
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {

test/unit/features/directives/on.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ describe('Directive v-on', () => {
123123
data: {
124124
ok: true
125125
},
126-
render () {
127-
const h = this.$createElement
126+
render (h) {
128127
return this.ok
129128
? h('input', { on: { click: this.foo }})
130129
: h('input', { on: { input: this.bar }})
@@ -155,8 +154,7 @@ describe('Directive v-on', () => {
155154
template: '<div></div>'
156155
}
157156
},
158-
render () {
159-
const h = this.$createElement
157+
render (h) {
160158
return this.ok
161159
? h('test', { on: { foo: this.foo }})
162160
: h('test', { on: { bar: this.bar }})

test/unit/features/directives/ref.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ describe('Directive v-ref', () => {
2828
it('should work as a hyperscript prop', () => {
2929
const vm = new Vue({
3030
components,
31-
render () {
32-
const h = this.$createElement
31+
render (h) {
3332
return h('div', null, [
3433
h('test', { ref: 'test' })
3534
])

test/unit/features/options/el.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ describe('Options el', () => {
2929
el.innerHTML = '<span>{{message}}</span>'
3030
const vm = new Vue({
3131
el,
32-
render () {
33-
const h = this.$createElement
32+
render (h) {
3433
return h('p', { staticAttrs: { id: 'app' }}, [
3534
h('span', {}, [this.message])
3635
])

test/unit/features/options/render.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import Vue from 'entries/web-runtime'
33
describe('Options render', () => {
44
it('basic usage', () => {
55
const vm = new Vue({
6-
render () {
7-
const h = this.$createElement
6+
render (h) {
87
const children = []
98
for (let i = 0; i < this.items.length; i++) {
109
children.push(h('li', { staticClass: 'task' }, [this.items[i].name]))
@@ -25,8 +24,7 @@ describe('Options render', () => {
2524

2625
it('allow null data', () => {
2726
const vm = new Vue({
28-
render () {
29-
const h = this.$createElement
27+
render (h) {
3028
return h('div', null, 'hello' /* string as children*/)
3129
}
3230
}).$mount()

0 commit comments

Comments
 (0)