Skip to content

Commit

Permalink
Added check to use baseVal for svg elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hardin committed Jul 17, 2019
1 parent 9a63797 commit 5efa908
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/dom/document-cloner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,15 @@ export class DocumentCloner {
});

anonymousReplacedElement.className = `${PSEUDO_HIDE_ELEMENT_CLASS_BEFORE} ${PSEUDO_HIDE_ELEMENT_CLASS_AFTER}`;
clone.className +=
pseudoElt === PseudoElementType.BEFORE
? ` ${PSEUDO_HIDE_ELEMENT_CLASS_BEFORE}`
: ` ${PSEUDO_HIDE_ELEMENT_CLASS_AFTER}`;
const addClass = pseudoElt === PseudoElementType.BEFORE
? ` ${PSEUDO_HIDE_ELEMENT_CLASS_BEFORE}`
: ` ${PSEUDO_HIDE_ELEMENT_CLASS_AFTER}`;
if ((<any>(clone.className)).baseVal) {
// Use baseVal for svg elements
(<any>(clone.className)).baseVal += addClass;
} else {
clone.className += addClass;
}
return anonymousReplacedElement;
}
}
Expand Down

1 comment on commit 5efa908

@ahardin13
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for Clone node: Setting className for SVG element raises error niklasvh#1868

Please sign in to comment.