Skip to content

Commit

Permalink
feat: exclude background-image none from DOM (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
kptdobe authored Nov 1, 2023
1 parent 74291b9 commit 8dbfd5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/shared/pollimporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
*/
/* global WebImporter */

const DEFAULT_SUPPORTED_STYLES = ['background-image'];
const DEFAULT_SUPPORTED_STYLES = [{ name: 'background-image', exclude: /none/g }];

function deepCloneWithStyles(document, styles = DEFAULT_SUPPORTED_STYLES) {
const clone = document.cloneNode(true);

const applyStyles = (nodeSrc, nodeDest) => {
const style = window.getComputedStyle(nodeSrc, null);

styles.forEach((styleName) => {
if (style[styleName]) {
nodeDest.style[styleName] = style[styleName];
styles.forEach((s) => {
if (style[s.name]) {
if (!s.exclude || !(style[s.name].match(s.exclude))) {
nodeDest.style[s.name] = style[s.name];
}
}
});

Expand Down

0 comments on commit 8dbfd5a

Please sign in to comment.