github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

jquery / jquery

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
    • 4,734
    • 427
  • Source
  • Commits
  • Network
  • Pull Requests (23)
  • Graphs
  • Tree: 36a98b9

click here to add a description

click here to add a homepage

  • Switch Branches (2)
    • master
    • omgrequire
  • Switch Tags (45)
    • 1.4rc1
    • 1.4a2
    • 1.4a1
    • 1.4.4rc1
    • 1.4.3rc2
    • 1.4.3rc1
    • 1.4.3
    • 1.4.2
    • 1.4.1
    • 1.4
    • 1.3rc1
    • 1.3b2
    • 1.3b1
    • 1.3.2
    • 1.3.1rc1
    • 1.3.1
    • 1.3
    • 1.2.6
    • 1.2.5
    • 1.2.4b
    • 1.2.4a
    • 1.2.4
    • 1.2.3b
    • 1.2.3a
    • 1.2.3
    • 1.2.2b2
    • 1.2.2b
    • 1.2.2
    • 1.2.1
    • 1.2
    • 1.1b
    • 1.1a
    • 1.1.4
    • 1.1.3a
    • 1.1.3.1
    • 1.1.3
    • 1.1.2
    • 1.1.1
    • 1.1
    • 1.0a
    • 1.0.4
    • 1.0.3
    • 1.0.2
    • 1.0.1
    • 1.0
  • Comments
  • Contributors
Sending Request…
Downloads

jQuery JavaScript Library — Read more

  Cancel

http://jquery.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Make sure we use detach instead of remove in replaceWith. Fixes #5785.
jeresig (author)
Mon Jan 11 12:57:45 -0800 2010
commit  36a98b95c2f3f7617ddf
tree    bbbaeb579109584adf91
parent  366039a6f05ffa09630e

Showing 2 changed files with 11 additions and 2 deletions.

M src/manipulation.js 2 ••
M test/unit/manipulation.js 11 ••••
Txt src/manipulation.js
  • View file @ 36a98b9
... ...
@@ -216,7 +216,7 @@ jQuery.fn.extend({
216 216
       return this.each(function() {
217 217
         var next = this.nextSibling, parent = this.parentNode;
218 218
 
219  
-        jQuery(this).remove();
  219
+        jQuery(this).detach();
220 220
 
221 221
         if ( next ) {
222 222
           jQuery(next).before( value );
Txt test/unit/manipulation.js
  • View file @ 36a98b9
... ...
@@ -626,7 +626,7 @@ test("insertAfter(String|Element|Array<Element>|jQuery)", function() {
626 626
 });
627 627
 
628 628
 var testReplaceWith = function(val) {
629  
-  expect(14);
  629
+  expect(16);
630 630
   jQuery('#yahoo').replaceWith(val( '<b id="replace">buga</b>' ));
631 631
   ok( jQuery("#replace")[0], 'Replace element with string' );
632 632
   ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' );
... ...
@@ -648,6 +648,15 @@ var testReplaceWith = function(val) {
648 648
   ok( jQuery("#mark")[0], 'Replace element with set of elements' );
649 649
   ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
650 650
 
  651
+  reset();
  652
+  var tmp = jQuery("<div/>").appendTo("body").click(function(){ ok(true, "Newly bound click run." ); });
  653
+  var y = jQuery('#yahoo').click(function(){ ok(true, "Previously bound click run." ); });
  654
+  y.replaceWith( tmp );
  655
+  tmp.click();
  656
+  y.click();
  657
+
  658
+  reset();
  659
+
651 660
   var set = jQuery("<div/>").replaceWith(val("<span>test</span>"));
652 661
   equals( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." );
653 662
   equals( set.length, 1, "Replace the disconnected node." );

0 notes on commit 36a98b9

Please log in to comment.
Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • Русский
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Русский
  • Српски
  • Svenska
  • 中文

Keyboard Shortcuts

Site wide shortcuts

s
Focus site search
?
Bring up this help dialog

Commit list

j
Move selected down
k
Move selected up
t
Open tree
p
Open parent
c or o or enter
Open commit

Pull request list

j
Move selected down
k
Move selected up
o or enter
Open issue

Issues

j
Move selected down
k
Move selected up
x
Toggle select target
o or enter
Open issue
I
Mark selected as read
U
Mark selected as unread
e
Close selected
y
Remove selected from view
c
Create issue
l
Create label
i
Back to inbox
u
Back to issues
/
Focus issues search

Network Graph

← or h
Scroll left
→ or l
Scroll right
↑ or k
Scroll up
↓ or j
Scroll down
t
Toggle visibility of head labels
shift ← or shift h
Scroll all the way left
shift → or shift l
Scroll all the way right
shift ↑ or shift k
Scroll all the way up
shift ↓ or shift j
Scroll all the way down