turbolinks / turbolinks-classic

Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
MIT License
3.54k stars 428 forks source link

Does 'partial-load' really get `changedNodes`? #613

Closed metaskills closed 8 years ago

metaskills commented 8 years ago

When writing events handlers like this for partial-load:

$(document).on('page:partial-load', function(changedNodes) {
  // ...
});

I am finding that the changedNodes argument is actually a jQuery event. I could not find an interface to to talk to these like document fragments or what I can do with these? Are these supposed to be jQuery event objects?

Thibaut commented 8 years ago

The changed nodes are in event.data.

metaskills commented 8 years ago

I thought about looking there... but did not see it? Thanks in advance for the help!

screen shot 2015-09-24 at 1 56 47 pm

Thibaut commented 8 years ago

Hmm that's weird. Is there anything in event.originalEvent.data?

metaskills commented 8 years ago

Bingo!

screen shot 2015-09-24 at 1 58 19 pm

Thibaut commented 8 years ago

Too bad jQuery doesn't make the DOM event's data available on its custom event object…

I'll close this when I update the docs to mention that.

metaskills commented 8 years ago

Thanks!!!