alexdunphy / units

Got units? Convert them! Parse length, angle and resolution CSS values and convert between units.
MIT License
26 stars 7 forks source link

Dependency on document.body #2

Open ollietb opened 7 years ago

ollietb commented 7 years ago

This library was required from a Node Canvas dependency in our app and was failing because our code was initialised in the head rather than the body, so document.body didn't exist. This was the error for anyone googling

utilities.js: Uncaught TypeError: Cannot read property 'appendChild' of null

hygkui commented 7 years ago

same problem.

ollietb commented 7 years ago

@hygkui I managed to get it to work by moving the code to the bottom of the body tag rather than in the head

RobIsHere commented 1 year ago

Why is the Size of one DPI measured anyway? Please note the css specification:

https://www.w3.org/TR/css3-values/#absolute-lengths "The absolute length units are fixed in relation to each other [...] The absolute units consist of the physical units (in, cm, mm, pt, pc, Q) and the visual angle unit (px):"