Import code from jquery.turbolinks #86

Closed
wants to merge 11 commits into from

6 participants

@kossnocorp

Discussion: #78

@ryw

+1

Perhaps a short doc above the code explaining the issue why this was added to turbolinks, and update README to explain how/when to use this?

Once this is merged in I'd be happy to add the docs.

@kossnocorp

Suddenly we found bug in jquery.turbolinks (kossnocorp/jquery.turbolinks#4). Now it fixed (kossnocorp/jquery.turbolinks@3212b54). Sorry.

@kossnocorp

One more bug was fixed: kossnocorp/jquery.turbolinks#6

@dhh

Good deal. Can we get some documentation to go with this?

@davydotcom

wow @dhh on a role today :)

@kossnocorp

Update:

  • Set $.isReady to false after page:fetch #6;
  • add $.setFetchEvent function;
  • remove all delegated events after trigger fetch event #8.
@kossnocorp

@dhh about documentation: I'm far away from native speaker, so it's better to delegate work on documentation to someone else. But anyway, I can copy texts from kossnocorp/jquery.turbolinks/README.

@аll Hey guys, can you help me with documentation to jquery.turbolinks? You can rework README for jquery.turbolinks or write new one from scratch. Thanks! /cc @ryw

@kossnocorp

@dhh what do you think about import specs from jquery.turbolinks?

@ryw

@kossnocorp yeah, I'll take a crack at docs.

@dhh
@yasuoza

I tried writing complete tests using phantomjs and poltergeist, because poltergeist supports network_traffic monitoring.
But phantomjs does not support window.history.state, so it was failed.

Does anyone have another idea for complete suite?

@kossnocorp

@YasuOza I'm pretty sure it can be done via Mocha + Chai.js + Sinon.js. Actually I successfully emulate DOM in jquery.turbolinks via jsdom: https://github.com/kossnocorp/jquery.turbolinks/blob/master/spec/jquery.turbolinks_spec.coffee#L3:L4.

@kossnocorp

Actually I was start building specs for Turbolinks, but I'm not sure when I can finish it: kossnocorp/turbolinks@1b109a7.

@yasuoza

@kossnocorp Can those emulate accessing assets changed page through turbolinks and detect it?

@kossnocorp

@YasuOza we can just stub requests, isn't?

@yasuoza

@kossnocorp Keep going. I also think about test for turbolinks.

@kossnocorp

Docs are shipped 🎉! @ryw, thank you a lot!

@macournoyer

Maybe I'm missing something, but couldn't all this code be replaced w/

$.fn.ready = (callback) -> $(document).on 'page:load', callback

What's the point of reimplementing callback dispatching?

@davydotcom
@macournoyer

Here's the actual code I use:

jQuery_ready = $.fn.ready

$.fn.ready = (callback) ->
  jQuery_ready callback
  $(document).on 'page:load', callback

Binding the callbacks to document ready AND page:load.

I believe it does the same thing.

@davydotcom

perhaps it may be better afterall to leave jquery.turbolinks as a seperate gem seeing as how there are still updates being made and in the event jquery library itself has any changes, may be easier to get updates pushed out rather than including here.

@dhh

I agree. Doesn't seem like it's so cut and dry. Let's keep it separate from now and see how it goes.

But let's get that COMPATIBILITY readme going.

@dhh dhh closed this Jan 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment