-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow non-pjax page updates. #684
base: master
Are you sure you want to change the base?
Conversation
// | ||
// These following selectors define which elements are transitioned with | ||
// simple DOM replacement and are always immediate children of <body> | ||
var barSelectors = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any reason to keep the list of bar element selectors in an object (see the key/value pairs at the top of push.js
). So it's a simple list of selectors now.
@ndelage This is failing in Travis: https://travis-ci.org/twbs/ratchet/builds/36779341 |
Yeah, I noticed. The linter doesn't think I'm welcome to any suggestions if you've dealt with a similar issue before. |
Change |
5b441a9
to
51ccdf4
Compare
Thanks, Travis is passing now. |
transitionContent(newContentDiv, existingContentDiv, | ||
transition, complete); | ||
} else { | ||
document.body.innerHTML = contents.innerHTML; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndelage Suggest to modify this line as follows:
document.body.innerHTML = "";
document.body.appendChild( contents );
This will ensure that all bound events and data will remain attached to the element instead of "flattening" it to just HTML string
Thanks for the comments @avinoamr, these are spot on. I agree with moving I'll submit the relevant changes in the next day or so. |
} | ||
|
||
container.parentNode.insertBefore(swap, container); | ||
complete && complete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndelage If transition is set, you end up calling complete()
twice - once here and again when the transition completes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the premature (before the transition completes) call to complete
. In my version transitionContent
is only called when a transition is present.
Now appending content instead setting |
f31fe28
to
1637b4f
Compare
Pinging @connor for a review. |
I'd love some feedback, but given the potential that we move to a module approach with a single top-level object/namspace Later if we move towards a single |
Cool PR. It would definitely help our project. I've not dived deep in, but is it able to take DOM over raw html? |
Yep, that's the idea. The |
Cool! I just gave this ago but I seem to have a couple of problems. I tried to use |
Hey @Tarang, sorry for the delay. I just pushed an update, including auto-generated js & css in var contents = "<div><div class='bar-tab'></div><div class='bar-nav'></div><div class='contents'<p>Foo Bar Baz</p></div></div>";
TRANSITION(contents, 'slide-left'); The single wrapper Give it another shot and let me know if you run into any issues. |
Is anybody else noticing a memory leak on transitions? |
Could you test master for the same leak? Can you provide details on how you've been testing for memory leaks? |
Just added a step to clone the |
Disclaimer: I'm no expert in tracking down memory leaks or profiling JS. I ran some tests using Chrome's timeline, tracking memory usage over time and forcing garbage collection a few times throughout the test. After each GC, it looks like everything has been cleaned up. I don't see a memory increase: |
Thanks Nate for the reply! I looked deeper into it and it seems like it may be a weird jQuery XHR issue, and not related to the TRANSITION call. I also looked at the DOM through the remote Safari debugger and it looks like everything is being cleaned up correctly. So sorry about that. |
a4c77f5
to
f95101c
Compare
Is this likely to be merged? |
@ndelage: can you rebase and clean up this branch? |
+11111111 to this :) |
@ndelage: please fetch and rebase. |
Will do. I'll get to this in the next few days. |
Extract transition functionality from push.js into a new file, transitions.js. Expose a global function, similar to PUSH named TRANSITION used to transition from one page/view to another without dictating how the new markup is sourced. This allows for Ratchet style page transitions when rendering client side.
Ensure that all bound events and data will remain attached to the element instead of "flattening" it to just HTML string.
f95101c
to
0961870
Compare
Just pushed a rebased branch, switching over to the new |
|
Roger. I'll make those changes. |
Any updates ? |
Extract transition functionality from push.js into a new file, transitions.js.
Expose a global function, similar to PUSH named TRANSITION used to transition
from one page/view to another without dictating how the new markup is sourced.
This allows for Ratchet style page transitions when rendering client side.
I'll add comments to the diff shortly, highlighting some of the changes I've made.