[Webkit-unassigned] [Bug 26525] New: Implement swapNode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 18 15:55:17 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=26525

           Summary: Implement swapNode
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
               URL: http://msdn.microsoft.com/en-
                    us/library/ms536774(VS.85,loband).aspx
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Enhancement
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: arv at chromium.org


Swapping the place of two nodes in a document is not that hard but it requires
more code than one would expect. It would be nice if we could add this MS
extension.

Here is a pure JS implementation:

Node.prototype.swapNode = function(that) {
  var nextSibling = this.nextSibling;
  if (nextSibling == that) {
    that.swapNode(this);
    return;
  }
  var thisParent = this.parentNode;
  that.parentNode.replaceChild(this, that);
  thisParent.insertBefore(that, nextSibling);
};


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list