@ampify/aquery
Advanced tools
Comparing version 2.0.2 to 2.0.3
{ | ||
"name": "@ampify/aquery", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"main": "./dist/aquery.js", | ||
@@ -5,0 +5,0 @@ "module": "./src", |
@@ -762,10 +762,17 @@ import jQuery from 'jquery'; | ||
aQuery.keepElements = (elements) => { | ||
elements.forEach(element => { | ||
if (element instanceof jQuery) { | ||
element.attr('ampify-keep', ''); | ||
} else { | ||
element.setAttribute('ampify-keep', ''); | ||
} | ||
}); | ||
if (elements instanceof Array) { | ||
elements.forEach(element => { | ||
keepElement(element); | ||
}); | ||
} else { | ||
keepElement(elements); | ||
} | ||
}; | ||
const keepElement = (element) => { | ||
if (element instanceof jQuery) { | ||
element.attr('ampify-keep', ''); | ||
} else if (element instanceof HTMLElement) { | ||
element.setAttribute('ampify-keep', ''); | ||
} | ||
} | ||
@@ -772,0 +779,0 @@ aQuery.injectCss = injectCss; |
48950
1554