Using width/height without units in HTML5
Before HTML5, I use to set the width/height of an element through
element.style.width = 50 element.style.height = 100
and it used to consider 'px' as the default unit. After adding <!DOCTYPE html> all these are failing as I need to explicitly set the units while setting measurements. As I am using some of the libraries which used this style, its a lot of work to individually add 'px' to each of them. I am looking for a shim/polyfill to handle this automatically.
We can't really use any shims/polyfill either since we are directly dealing with the DOM. Hence I greped the code for the pattern and fix them.
But adding px will give you a
Bad value (number)px for attribute height on element img: Expected a digit but saw p
if you put it into an HTML validator