Skip to content

Commit c1156f2

Browse files
committed
Fix title removal to maintain text at top level
1 parent 14fc9d2 commit c1156f2

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
@@ -611,7 +611,7 @@ function extractContainer(data, xhr, options) {
611611
// Clean up any <title> tags
612612
if (obj.contents) {
613613
// Remove any parent title elements
614-
obj.contents = obj.contents.not('title')
614+
obj.contents = obj.contents.not(function() { return $(this).is('title') })
615615

616616
// Then scrub any titles from their descendents
617617
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)