refactor: option merging + extract helper functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createRenderer, VNode, ComponentInstance } from '@vue/core'
|
||||
import { createRenderer, VNode, Component } from '@vue/core'
|
||||
import { nodeOps } from './nodeOps'
|
||||
import { patchData } from './patchData'
|
||||
import { teardownVNode } from './teardownVNode'
|
||||
@@ -12,7 +12,7 @@ const { render: _render } = createRenderer({
|
||||
type publicRender = (
|
||||
node: VNode | null,
|
||||
container: HTMLElement
|
||||
) => ComponentInstance | null
|
||||
) => Component | null
|
||||
export const render = _render as publicRender
|
||||
|
||||
// re-export everything from core
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { isString } from '@vue/shared'
|
||||
|
||||
// style properties that should NOT have "px" added when numeric
|
||||
const nonNumericRE = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i
|
||||
|
||||
@@ -5,7 +7,7 @@ export function patchStyle(el: any, prev: any, next: any, data: any) {
|
||||
const { style } = el
|
||||
if (!next) {
|
||||
el.removeAttribute('style')
|
||||
} else if (typeof next === 'string') {
|
||||
} else if (isString(next)) {
|
||||
style.cssText = next
|
||||
} else {
|
||||
for (const key in next) {
|
||||
@@ -15,7 +17,7 @@ export function patchStyle(el: any, prev: any, next: any, data: any) {
|
||||
}
|
||||
style[key] = value
|
||||
}
|
||||
if (prev && typeof prev !== 'string') {
|
||||
if (prev && !isString(prev)) {
|
||||
for (const key in prev) {
|
||||
if (!next[key]) {
|
||||
style[key] = ''
|
||||
|
||||
Reference in New Issue
Block a user