Skip to content

Commit a5b4c10

Browse files
committed
Solved bug when timeout does not find container
1 parent 9e06b5f commit a5b4c10

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

dist/build.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/build.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-ripple-directive",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Vue Material Ripple Effect Directive",
55
"main": "src/ripple.js",
66
"repository": {

src/ripple.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,23 @@ export default {
8484
ripple.style.backgroundColor = "rgba(0, 0, 0, 0)";
8585
}, 250);
8686

87+
// Timeout set to get a smooth removal of the ripple
8788
setTimeout(function() {
88-
rippleContainer.parentNode.removeChild(rippleContainer);
89+
// Conditional to avoid not finding parent when to many ripples are executed
90+
if (rippleContainer.parentNode)
91+
rippleContainer.parentNode.removeChild(rippleContainer);
8992
}, 850);
9093
})
9194
} else {
9295
setTimeout(function() {
9396
ripple.style.backgroundColor = "rgba(0, 0, 0, 0)";
9497
}, 250);
9598

99+
// Timeout set to get a smooth removal of the ripple
96100
setTimeout(function() {
97-
rippleContainer.parentNode.removeChild(rippleContainer);
101+
// Conditional to avoid not finding parent when to many ripples are executed
102+
if (rippleContainer.parentNode)
103+
rippleContainer.parentNode.removeChild(rippleContainer);
98104
}, 850);
99105
}
100106
}

0 commit comments

Comments
 (0)