File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,14 @@ const plugin = (options = {}) => (tree) => {
1818 if ( k === "class" && node2 . attrs && node2 . attrs . class ) {
1919 node2 . attrs . class = [ .../* @__PURE__ */ new Set ( [ ...node2 . attrs . class . split ( " " ) , ...v . split ( " " ) ] ) ] . join ( " " ) ;
2020 } else {
21- const attributesToOmit = Object . keys ( node2 . attrs || { } ) ;
22- const { [ attributesToOmit ] : _ , ...remainingAttributes } = options . attributes [ key ] ;
21+ const existingAttributes = node2 . attrs || { } ;
22+ const remainingAttributes = Object . fromEntries (
23+ Object . entries (
24+ options . attributes [ key ]
25+ ) . filter (
26+ ( [ attrKey ] ) => ! ( attrKey in existingAttributes )
27+ )
28+ ) ;
2329 const attributes2 = options . overwrite ? options . attributes [ key ] : remainingAttributes ;
2430 node2 . attrs = { ...node2 . attrs , ...attributes2 } ;
2531 }
Original file line number Diff line number Diff line change @@ -12,8 +12,14 @@ const plugin = (options = {}) => (tree) => {
1212 if ( k === "class" && node2 . attrs && node2 . attrs . class ) {
1313 node2 . attrs . class = [ .../* @__PURE__ */ new Set ( [ ...node2 . attrs . class . split ( " " ) , ...v . split ( " " ) ] ) ] . join ( " " ) ;
1414 } else {
15- const attributesToOmit = Object . keys ( node2 . attrs || { } ) ;
16- const { [ attributesToOmit ] : _ , ...remainingAttributes } = options . attributes [ key ] ;
15+ const existingAttributes = node2 . attrs || { } ;
16+ const remainingAttributes = Object . fromEntries (
17+ Object . entries (
18+ options . attributes [ key ]
19+ ) . filter (
20+ ( [ attrKey ] ) => ! ( attrKey in existingAttributes )
21+ )
22+ ) ;
1723 const attributes2 = options . overwrite ? options . attributes [ key ] : remainingAttributes ;
1824 node2 . attrs = { ...node2 . attrs , ...attributes2 } ;
1925 }
You can’t perform that action at this time.
0 commit comments