wip: update test runtime

This commit is contained in:
Evan You
2019-06-20 21:28:37 +08:00
parent 9c0f820a8e
commit 645c1eceea
7 changed files with 245 additions and 252 deletions

View File

@@ -1,10 +1,11 @@
import { createRenderer, VNode } from '@vue/runtime-core'
import { DOMRendererOptions } from './rendererOptions'
import { nodeOps } from './nodeOps'
import { patchProp } from './patchProp'
export const render = createRenderer(DOMRendererOptions) as (
vnode: VNode | null,
container: HTMLElement
) => VNode
export const render = createRenderer({
patchProp,
...nodeOps
}) as (vnode: VNode | null, container: HTMLElement) => VNode
// re-export everything from core
// h, Component, observer API, nextTick, flags & types

View File

@@ -1,12 +1,7 @@
import { RendererOptions } from '@vue/runtime-core'
import { patchProp } from './patchProp'
const doc = document
const svgNS = 'http://www.w3.org/2000/svg'
export const DOMRendererOptions: RendererOptions = {
patchProp,
export const nodeOps = {
insert: (child: Node, parent: Node, anchor?: Node) => {
if (anchor != null) {
parent.insertBefore(child, anchor)
@@ -16,7 +11,6 @@ export const DOMRendererOptions: RendererOptions = {
},
remove: (child: Node) => {
if (!child) debugger
const parent = child.parentNode
if (parent != null) {
parent.removeChild(child)