An Interest In:
Web News this Week
- April 30, 2024
- April 29, 2024
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
April 12, 2018 02:05 pm GMT
Original Link: https://developers.google.com/web/updates/2018/03/cssom
Working With the new CSS Typed Object Model
Eric Bidelman introduces the CSS Typed Object Model. It looks like it's going to make dealing with getting and setting style values through JavaScript easier and less error-prone. Less stringy, more number-y when appropriate.
Like if we wanted to know the padding of an element, classically we'd do:
var el = document.querySelector("#thing");
var style = window.getComputedStyle(el);
console.log(style.padding);
And we'd get "20px" as a string or whatever it is.
One of these new API's lets us pull it off like this:…
The post Working With the new CSS Typed Object Model appeared first on CSS-Tricks.
Original Link: https://developers.google.com/web/updates/2018/03/cssom
Share this article:
Tweet
View Full Article