mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-10 16:38:25 +08:00
remove unnecessary slice in SSR renderStyle (small perf gain)
This commit is contained in:
parent
938fa4efcc
commit
c9fbcaf591
@ -8,7 +8,7 @@ function genStyleText (vnode: VNode): string {
|
|||||||
for (const key in style) {
|
for (const key in style) {
|
||||||
styleText += `${hyphenate(key)}:${style[key]};`
|
styleText += `${hyphenate(key)}:${style[key]};`
|
||||||
}
|
}
|
||||||
return styleText.slice(0, -1)
|
return styleText
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function renderStyle (vnode: VNodeWithData): ?string {
|
export default function renderStyle (vnode: VNodeWithData): ?string {
|
||||||
|
@ -102,7 +102,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<div server-rendered="true" style="background-color:black;font-size:14px;color:red"></div>'
|
'<div server-rendered="true" style="background-color:black;font-size:14px;color:red;"></div>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -116,7 +116,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<div server-rendered="true" style="color:red"></div>'
|
'<div server-rendered="true" style="color:red;"></div>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -135,7 +135,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<section server-rendered="true"><div style="color:red"></div></section>'
|
'<section server-rendered="true"><div style="color:red;"></div></section>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -159,7 +159,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<div server-rendered="true" style="text-align:left;font-size:520rem;color:red"></div>'
|
'<div server-rendered="true" style="text-align:left;font-size:520rem;color:red;"></div>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -178,7 +178,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<div server-rendered="true" style="color:red"><div></div></div>'
|
'<div server-rendered="true" style="color:red;"><div></div></div>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -197,7 +197,7 @@ describe('SSR: renderToString', () => {
|
|||||||
}
|
}
|
||||||
}, result => {
|
}, result => {
|
||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'<div server-rendered="true" style="color:red"><span style="color:black"></span></div>'
|
'<div server-rendered="true" style="color:red;"><span style="color:black;"></span></div>'
|
||||||
)
|
)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user