} from '@vue/runtime-dom'
import type { RawProps } from './componentProps'
import { getGlobalThis } from '@vue/shared'
+import { optimizePropertyLookup } from './dom/prop'
let _createApp: CreateAppFunction<ParentNode, VaporComponent>
const mountApp: AppMountFn<ParentNode> = (app, container) => {
+ optimizePropertyLookup()
+
// clear content before mounting
if (container.nodeType === 1 /* Node.ELEMENT_NODE */) {
container.textContent = ''
}
return value
}
+
+let isOptimized = false
+
+/**
+ * Optimize property lookup for cache properties on Element and Text nodes
+ */
+export function optimizePropertyLookup(): void {
+ if (isOptimized) return
+ isOptimized = true
+ const proto = Element.prototype as any
+ proto.$evtclick = undefined
+ proto.$root = false
+ proto.$html =
+ proto.$txt =
+ proto.$cls =
+ proto.$sty =
+ (Text.prototype as any).$txt =
+ ''
+}
import {
+ type App,
type ComponentInternalInstance,
type ConcreteComponent,
MoveType,
import type { RawSlots, VaporSlot } from './componentSlots'
import { renderEffect } from './renderEffect'
import { createTextNode } from './dom/node'
+import { optimizePropertyLookup } from './dom/prop'
// mounting vapor components and slots in vdom
const vaporInteropImpl: Omit<
vdomUnmount: internals.umt,
vdomSlot: renderVDOMSlot.bind(null, internals),
})
+ const mount = app.mount
+ app.mount = ((...args) => {
+ optimizePropertyLookup()
+ return mount(...args)
+ }) satisfies App['mount']
}