W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

[Bug 13971] New: Define a renameNode method

From: <bugzilla@jessica.w3.org>
Date: Tue, 30 Aug 2011 16:48:39 +0000
To: www-dom@w3.org
Message-ID: <bug-13971-4009@http.www.w3.org/Bugs/Public/>

           Summary: Define a renameNode method
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DOM Core
        AssignedTo: annevk@opera.com
        ReportedBy: ayg@aryeh.name
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, www-dom@w3.org



DOM 3 Core defined a renameNode() method that no one implemented.  Ehsan,
Ryosuke, and I agreed at our face-to-face meeting that such a thing would be
useful for editing.  Dimitri said in that thread that he thinks it would be
useful for Component Model.

The existing definition leaves too many things undefined, though, and has other
bad traits (like sometimes replacing the node and sometimes not, and being on
Document instead of Element).  Things it should do:

* Should be a method on Element, probably called renameElement() or just
* For consistency/completeness, probably should take a single argument that's
the new name, which will be lowercased for HTML documents, and have a
rename(Element)NS() variant.
* Always make a new element with the desired name.  Don't ever leave the
existing one in place.
* Copy all DOM attributes, event listeners, and custom JS properties that were
stuck on the object.
* Move all range endpoints appropriately.  (This can be left to DOM Range as
long as it's not yet merged into Core.)
* Stick the new node next to the old one, move all the children, then remove
the old one.
* Return the new node.

This is pretty nontrivial for authors to get right, and on some points
impossible in general (like updating all range endpoints), so it seems like a
good thing for browsers to implement.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Tuesday, 30 August 2011 16:48:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC