Skip to content

Commit 59868bb

Browse files
committed
use boundingClientRect for svg element hidden detection (fix #2396)
1 parent 5f9d762 commit 59868bb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/transition/transition.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,16 @@ p.setupCssCb = function (event, cb) {
379379
*/
380380

381381
function isHidden (el) {
382-
return !(
383-
el.offsetWidth ||
384-
el.offsetHeight ||
385-
el.getClientRects().length
386-
)
382+
if (/svg$/.test(el.namespaceURI)) {
383+
// SVG elements do not have offset(Width|Height)
384+
// so we need to check the client rect
385+
var rect = el.getBoundingClientRect()
386+
return !(rect.width || rect.height)
387+
} else {
388+
return !(
389+
el.offsetWidth ||
390+
el.offsetHeight ||
391+
el.getClientRects().length
392+
)
393+
}
387394
}

0 commit comments

Comments
 (0)