turbolinks 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
- initialized = false
2
- currentState = null
3
- referer = document.location.href
4
- assets = []
5
- pageCache = []
6
-
1
+ initialized = false
2
+ currentState = null
3
+ referer = document.location.href
4
+ assets = []
5
+ pageCache = []
6
+ createDocument = null
7
7
 
8
8
  visit = (url) ->
9
9
  if browserSupportsPushState
@@ -41,7 +41,7 @@ fetchHistory = (state) ->
41
41
  cacheCurrentPage()
42
42
 
43
43
  if page = pageCache[state.position]
44
- changePage page.title, page.body.cloneNode(true)
44
+ changePage page.title, page.body
45
45
  recallScrollPosition page
46
46
  triggerEvent 'page:restore'
47
47
  else
@@ -91,12 +91,12 @@ rememberCurrentState = ->
91
91
 
92
92
  rememberCurrentAssets = ->
93
93
  assets = extractAssets document
94
-
94
+
95
95
  rememberInitialPage = ->
96
96
  unless initialized
97
97
  rememberCurrentUrl()
98
98
  rememberCurrentState()
99
- rememberCurrentAssets()
99
+ createDocument = browserCompatibleDocumentParser()
100
100
  initialized = true
101
101
 
102
102
  recallScrollPosition = (page) ->
@@ -126,7 +126,7 @@ extractTitleAndBody = (doc) ->
126
126
  title = doc.querySelector 'title'
127
127
  [ title?.textContent, doc.body ]
128
128
 
129
- createDocument = (html) ->
129
+ browserCompatibleDocumentParser = ->
130
130
  createDocumentUsingParser = (html) ->
131
131
  (new DOMParser).parseFromString html, 'text/html'
132
132
 
@@ -141,9 +141,9 @@ createDocument = (html) ->
141
141
  testDoc = createDocumentUsingParser '<html><body><p>test'
142
142
 
143
143
  if testDoc?.body?.childNodes.length is 1
144
- createDocumentUsingParser html
144
+ createDocumentUsingParser
145
145
  else
146
- createDocumentUsingWrite html
146
+ createDocumentUsingWrite
147
147
 
148
148
 
149
149
  installClickHandlerLast = (event) ->
@@ -194,6 +194,7 @@ browserSupportsPushState =
194
194
  window.history and window.history.pushState and window.history.replaceState and window.history.state != undefined
195
195
 
196
196
  if browserSupportsPushState
197
+ rememberCurrentAssets()
197
198
  document.addEventListener 'click', installClickHandlerLast, true
198
199
 
199
200
  window.addEventListener 'popstate', (event) ->
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbolinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: david@loudthinking.com