I am trying to extract CSS properties from CSSRule. https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleRule This is a complete CSSRule object:
CSSStyleRule { parentRule: null, parentStyleSheet: CSSStyleSheet { parentStyleSheet: null, cssR ules: [ [Circular *1] ] }, selectorText: '.one', style: CSSStyleDeclaration { '0': 'display', length: 1, parentRule: [Circular *1], _importants: { display: '' }, __starts: 4, display: 'block' }, __starts: 0, __ends: 20 } I want to extract from this object to this:
{ display: 'block' } Is there any good way to extract that object from CSSRule.style? That object is very messy, and I don't know what props(e.g. display, color, font-size...) will be in that object ahead of time, thus I found it very difficult to extract declarations from there.
没有评论:
发表评论