Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onDomRefresh should only trigger if the view.el is actually in the DOM #855

Merged
merged 1 commit into from
Jan 13, 2014

Conversation

cobbweb
Copy link
Member

@cobbweb cobbweb commented Jan 13, 2014

So like 10 months later, I've finally got around to fixing this. :)

onDomRefresh never actually checked if the view.el was in the DOM, but just assumed it was based on events that had fired on the view (show and render).

This PR does an additional check in onDomRefresh against the DOM so we can guarantee it really is in the DOM.

FYI document.documentElement and document.documentElement.contains(x) should be safe to use.

I added a call to view.remove() so we didn't clog the page up with elements. Looks like there's lots of memory leaks in the tests... do we care about this? I always remove any views I created in my own tests.

Fixed #748 and fixes #479 and #505.

@samccone
Copy link
Member

@cobbweb the memory issue is not that big of an issue, since the tests are not perf dependent. Also since the testing env gets thrown out after tests I am not that worried about refactoring old tests

@samccone
Copy link
Member

👍

samccone added a commit that referenced this pull request Jan 13, 2014
onDomRefresh should only trigger if the view.el is actually in the DOM
@samccone samccone merged commit 1fd95a1 into marionettejs:master Jan 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle onDomRefresh when view.el is out of the dom Ignore this issue
2 participants