chore: notes on style binding optimization

This commit is contained in:
Evan You 2019-06-03 13:57:19 +08:00
parent 2848f65a7f
commit c442785465
3 changed files with 6 additions and 1 deletions

View File

@ -318,7 +318,6 @@ export function createRenderer(options: RendererOptions) {
// style
// this flag is matched when the element has dynamic style bindings
// TODO separate static and dynamic styles?
if (patchFlag & STYLE) {
hostPatchProp(el, 'style', newProps.style, oldProps.style, isSVG)
}

View File

@ -9,6 +9,7 @@ export {
Portal
} from './vnode'
export { nextTick } from './scheduler'
export { createComponent, FunctionalComponent } from './component'
export { createRenderer, RendererOptions } from './createRenderer'
export { Slot, Slots } from './componentSlots'

View File

@ -25,6 +25,11 @@ export const TEXT = 1
export const CLASS = 1 << 1
// Indicates an element with dynamic style
// The compiler pre-compiles static string styles into static objects
// + detects and hoists inline static objects
// e.g. style="color: red" and :style="{ color: 'red' }" both get hoisted as
// const style = { color: 'red' }
// render() { return e('div', { style }) }
export const STYLE = 1 << 2
// Indicates an element that has non-class/style dynamic props.