How to preserve parent mark which the same as current mark

The mark defines as below

parseDOM: [
    {
      tag: '[style]',
      consuming: false,
    },
  ],

When it parses a DOM tree which like:

<span style="color: red;"><span style="background: gray;">Hello World</span></span>

got

<span style="background: gray;">Hello World</span>

I know there is a “style” property in “parseDOM”, but I don’t want to dedine marks for each style properties(color, background, font-size etc)

Is there a way to preserve parent mark(style=“color: red;”)

Or I need to pass the styles to children manully(Cause in “getAttrs” I can mutate the DOM tree)

Hey guys! I’m solve this problem by “pass styles to children”. HAPPY :grinning: :grinning: :grinning:

Hi @synw1024 can you please provide the solution code I am also facing the same issue

  1. DFSing the element which is a param of getAttrs
  2. getting styles from parent
  3. setting styles to children which haven’t sets
getAttrs(elm) {
  dfs(elm) {
    // getting styles from elm
    for (let i = 0; i < elm.children.length; i++) {
      const child = elm.children[i]
      // setting styles to child
    }
  }
  dfs(elm)
}