Skip to content

Commit 1c0942c

Browse files
committed
1 parent a665d81 commit 1c0942c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

anime.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,16 @@
234234
var getAnimationType = function(el, prop) {
235235
if ((is.node(el) || is.svg(el)) && arrayContains(validTransforms, prop)) return 'transform';
236236
if ((is.node(el) || is.svg(el)) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';
237-
if ((is.node(el) || is.svg(el)) && (el.getAttribute(prop) || el[prop])) return 'attribute';
237+
if ((is.node(el) || is.svg(el)) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';
238238
if (!is.null(el[prop]) && !is.undef(el[prop])) return 'object';
239239
}
240240

241241
var getCSSValue = function(el, prop) {
242-
return getComputedStyle(el).getPropertyValue(stringToHyphens(prop));
242+
// First check if prop is a valid CSS property
243+
if (prop in el.style) {
244+
// Then return the property value or fallback to '0' when getPropertyValue fails
245+
return getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';
246+
}
243247
}
244248

245249
var getTransformValue = function(el, prop) {

anime.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)