Skip to content

Commit b3a48e5

Browse files
committed
Merge pull request #243 from sbader/master
Maintain text at top level after title removal
2 parents e6a3d7d + c1156f2 commit b3a48e5

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

jquery.pjax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ function extractContainer(data, xhr, options) {
645645
// Clean up any <title> tags
646646
if (obj.contents) {
647647
// Remove any parent title elements
648-
obj.contents = obj.contents.not('title')
648+
obj.contents = obj.contents.not(function() { return $(this).is('title') })
649649

650650
// Then scrub any titles from their descendents
651651
obj.contents.find('title').remove()

test/unit/pjax.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if ($.support.pjax) {
3535

3636
frame.$('#main').on('pjax:success', function() {
3737
equal(frame.$("#main > p").html().trim(), "Hello!")
38+
equal(frame.$("#main").contents().eq(1).text().trim(), "How's it going?")
3839
start()
3940
})
4041
frame.$.pjax({

test/views/hello.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<%= title 'Hello' %>
22
<p>Hello!</p>
3+
How's it going?
34
<script type="text/javascript">window.parent.iframeLoad(window)</script>

0 commit comments

Comments
 (0)