remove unnecessary slice in SSR renderStyle (small perf gain)

This commit is contained in:
Evan You 2017-01-19 23:41:17 -05:00
parent 938fa4efcc
commit c9fbcaf591
2 changed files with 7 additions and 7 deletions

View File

@ -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 {

View File

@ -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()
}) })