-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): should not render invalid numeric style values
Reverts part of 7d9cfeb - browsers only auto append units to numbers when in quirksmode, so in standard mode, numbers set to style properties that require units are invalid and should not be rendered.
- Loading branch information
Showing
2 changed files
with
8 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1528,14 +1528,14 @@ describe('SSR: renderToString', () => { | |
template: '<div :style="style"></div>', | ||
data: { | ||
style: { | ||
opacity: 0, // opacity should display as-is | ||
top: 0, // top and margin should be converted to '0px' | ||
marginTop: 10 | ||
opacity: 0, // valid, opacity is unit-less | ||
top: 0, // invalid, top requires unit | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Justineo
Member
|
||
marginTop: '10px' // valid | ||
} | ||
} | ||
}, result => { | ||
expect(result).toContain( | ||
'<div data-server-rendered="true" style="opacity:0;top:0px;margin-top:10px;"></div>' | ||
'<div data-server-rendered="true" style="opacity:0;margin-top:10px;"></div>' | ||
) | ||
done() | ||
}) | ||
|
Units are optional for
0
length values in CSS, so I think in this case it should be rendered. Bothtop:0
andtop:0px
are fine.