There's an easy way to find all current attributes on an HTMLElement using el.attributes
, but I can't find an equivalent for inline-styles. I've tried seeing if anyone else ran into this problem but there seems to be no relative results.
Doing something like this I was able to find all possible styles, but it also included all the functions and irrelevant data.
for( var style in el.style ){
console.log(el.style[style]);
}
This is a very wasteful computation for a loop that can be as large as 300+ iterations with a potential of 100% of the inline-styles not actually set to anything. Is there a better way?