rack-pjax 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -61,33 +61,9 @@ Requirements
61
61
  - Hpricot
62
62
 
63
63
 
64
- Author
64
+ Contributors
65
65
  ------
66
66
 
67
- Gert Goet (eval) :: gert@thinkcreate.nl :: @gertgoet
67
+ * eval
68
+ * matthooks
68
69
 
69
- License
70
- ------
71
-
72
- (The MIT license)
73
-
74
- Copyright (c) 2011 Gert Goet, ThinkCreate
75
-
76
- Permission is hereby granted, free of charge, to any person obtaining
77
- a copy of this software and associated documentation files (the
78
- "Software"), to deal in the Software without restriction, including
79
- without limitation the rights to use, copy, modify, merge, publish,
80
- distribute, sublicense, and/or sell copies of the Software, and to
81
- permit persons to whom the Software is furnished to do so, subject to
82
- the following conditions:
83
-
84
- The above copyright notice and this permission notice shall be
85
- included in all copies or substantial portions of the Software.
86
-
87
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
88
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
89
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
90
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
91
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
92
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
93
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -18,10 +18,12 @@ module Rack
18
18
  parsed_body = Hpricot(b)
19
19
  container = parsed_body.at("[@data-pjax-container]")
20
20
  if container
21
+ children = container.children
21
22
  title = parsed_body.at("title")
22
23
 
23
24
  new_body << title.to_s if title
24
- new_body << container.inner_html
25
+ # workaround hpricot bug (https://github.com/eval/rack-pjax/pull/5)
26
+ new_body << children.map { |c| c.to_original_html }.join
25
27
  else
26
28
  new_body << b
27
29
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Pjax
3
- VERSION = "0.5.4"
3
+ VERSION = "0.5.5"
4
4
  end
5
5
  end
@@ -10,8 +10,8 @@ describe Rack::Pjax do
10
10
  Rack::Pjax.new(
11
11
  lambda do |env|
12
12
  [
13
- 200,
14
- {'Content-Type' => 'text/plain', 'Content-Length' => Rack::Utils.bytesize(body).to_s},
13
+ 200,
14
+ {'Content-Type' => 'text/plain', 'Content-Length' => Rack::Utils.bytesize(body).to_s},
15
15
  [body]
16
16
  ]
17
17
  end
@@ -36,6 +36,14 @@ describe Rack::Pjax do
36
36
  body.should == "World!"
37
37
  end
38
38
 
39
+ it "should handle self closing tags with HTML5 elements" do
40
+ self.class.app = generate_app(:body => '<html><body><div data-pjax-container><article>World!<img src="test.jpg" /></article></div></body></html>')
41
+
42
+ get "/", {}, {"HTTP_X_PJAX" => "true"}
43
+
44
+ body.should == '<article>World!<img src="test.jpg" /></article>'
45
+ end
46
+
39
47
  it "should return the correct Content Length" do
40
48
  get "/", {}, {"HTTP_X_PJAX" => "true"}
41
49
  headers['Content-Length'].should == Rack::Utils.bytesize(body).to_s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-pjax
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 4
10
- version: 0.5.4
9
+ - 5
10
+ version: 0.5.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gert Goet
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-06 00:00:00 Z
18
+ date: 2011-11-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack