10000 transition: use more reliable hidden check (close #1398) · jslegers/vue@a0fa04d · GitHub
[go: up one dir, main page]

Skip to content

Commit a0fa04d

Browse files
committed
transition: use more reliable hidden check (close vuejs#1398)
1 parent 539b107 commit a0fa04d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/transition/transition.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,11 @@ p.setupCssCb = function (event, cb) {
357357
*/
358358

359359
function isHidden (el) {
360-
return el.style.display === 'none' ||
361-
el.style.visibility === 'hidden' ||
362-
el.hidden
360+
return !(
361+
el.offsetWidth &&
362+
el.offsetHeight &&
363+
el.getClientRects().length
364+
)
363365
}
364366

365367
module.exports = Transition

test/unit/specs/transition/transition_spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ if (_.inBrowser && !_.isIE9) {
8787
var el, vm, op, cb
8888
beforeEach(function () {
8989
el = document.createElement('div')
90+
el.textContent = 'hello'
9091
op = jasmine.createSpy('transition skip op')
9192
cb = jasmine.createSpy('transition skip cb')
9293
vm = new Vue()
@@ -135,6 +136,7 @@ if (_.inBrowser && !_.isIE9) {
135136
var vm, el, op, cb, hooks
136137
beforeEach(function (done) {
137138
el = document.createElement('div')
139+
el.textContent = 'hello'
138140
vm = new Vue({ el: el })
139141
op = jasmine.createSpy('css op')
140142
cb = jasmine.createSpy('css cb')
@@ -441,6 +443,7 @@ if (_.inBrowser && !_.isIE9) {
441443
beforeEach(function () {
442444
hooks = {}
443445
el = document.createElement('div')
446+
el.textContent = 'hello'
444447
document.body.appendChild(el)
445448
op = jasmine.createSpy('js transition op')
446449
cb = jasmine.createSpy('js transition cb')

0 commit comments

Comments
 (0)
0