Style binding silently omitting number values for size related styles
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
- Specify
<!DOCTYPE html>
(HTML5) inindex.html
. - Try to bind
width
using a number without specifying measurement (e.g.px
).
What is expected?
The width
style is omitted but I get a warning log.
What is actually happening?
No warning at all.
System Info
No response
Any additional comments?
Size related styles (width
, height
, fontSize
, etc) without measurement actually works correctly when not specifying <!DOCTYPE html>
(quirk mode), so this could be very confusing when someone adds back the missing doc type in the middle of development.
This is not what Vue should do.
It's 2023, and developers should always include <!DOCTYPE html>
declaration to ensure the document parses according to the specification.
If it is not omitted then the inspector will tell you it is an invalid value, so you know what's wrong. If it is omitted then people will likely wonder that something else goes wrong (I didn't see this omitting behavior mentioned in the doc?).
Guess I will just close this as WAI for future reference then.