wip: portal
This commit is contained in:
@@ -1,6 +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 = {
|
||||
@@ -23,11 +24,11 @@ export const DOMRendererOptions: RendererOptions = {
|
||||
},
|
||||
|
||||
createElement: (tag: string, isSVG?: boolean): Element =>
|
||||
isSVG ? document.createElementNS(svgNS, tag) : document.createElement(tag),
|
||||
isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag),
|
||||
|
||||
createText: (text: string): Text => document.createTextNode(text),
|
||||
createText: (text: string): Text => doc.createTextNode(text),
|
||||
|
||||
createComment: (text: string): Comment => document.createComment(text),
|
||||
createComment: (text: string): Comment => doc.createComment(text),
|
||||
|
||||
setText: (node: Text, text: string) => {
|
||||
node.nodeValue = text
|
||||
@@ -39,5 +40,7 @@ export const DOMRendererOptions: RendererOptions = {
|
||||
|
||||
parentNode: (node: Node): Node | null => node.parentNode,
|
||||
|
||||
nextSibling: (node: Node): Node | null => node.nextSibling
|
||||
nextSibling: (node: Node): Node | null => node.nextSibling,
|
||||
|
||||
querySelector: (selector: string): Node | null => doc.querySelector(selector)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user