Skip to content

Commit

Permalink
Remove track element during destroy only if it was created by glider
Browse files Browse the repository at this point in the history
It's not necessary to remove the track element during destroy if it was not created by glider but by the user (using skipTrack: true). Additionally, the statement assigning innerHTML to outerHTML causes problems with Content Security Policy without 'unsafe-inline' keyword or similar workaround.
  • Loading branch information
phautamaki authored and NickPiscitelli committed Oct 26, 2022
1 parent c24fa5d commit 905815d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,10 @@
/^glider/.test(className) && ele.classList.remove(className)
})
}
// remove track
replace.children[0].outerHTML = replace.children[0].innerHTML
// remove track if it was created by glider
if (!_.opt.skipTrack) {
replace.children[0].outerHTML = replace.children[0].innerHTML
}
clear(replace);
[].forEach.call(replace.getElementsByTagName('*'), clear)
_.ele.parentNode.replaceChild(replace, _.ele)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glider-js",
"version": "1.7.7",
"version": "1.7.8",
"description": "A fast, lightweight carousel alternative",
"main": "glider.js",
"directories": {
Expand Down

0 comments on commit 905815d

Please sign in to comment.