- From: Jeff Yates <PBWiz@PBWizard.com>
- Date: Fri, 16 Mar 2001 14:03:02 -0500
- To: <www-dom@w3.org>
- Message-ID: <008401c0ae4b$ba742d10$0100a8c0@pbwizshop>
I have run into an example not covered in the DOM-Range recommendation on range removal. The examples given in the recommendation are: (1) <FOO>AB<MOO>CD</MOO>CD</FOO> --> B<MOO>CD</MOO> (2) <FOO>A<MOO>BC</MOO>DE</FOO> --> <MOO>C<MOO>D (3) <FOO>XY<BAR>ZW</BAR>Q</FOO> --> Y<BAR>Z</BAR> (4) <FOO><BAR1>AB</BAR1><BAR2/><BAR3>CD</BAR3></FOO> --> <BAR1>B</BAR1><BAR2/><BAR3>C</BAR3> These are good examples but does not cover the following circumstance:<FOO>AB<MOO>CD</MOO>CD</FOO><FOO>AB<MOO>CD</MOO>CD</FOO>Notice how the range selects across elements with the same tag name. There are two ways this rangecould be removed from the source and the recommendation does not specify with method should be used.Method 1: Cut it out like it was text making sure all of the tags are properly closed:<FOO>AB<MOO>CD</MOO>CD</FOO>Method 2: Remove only those portions of each element that are in the range:<FOO>AB<MOO>C</MOO></FOO><FOO><MOO>D</MOO>CD</FOO>In my opinion the first method is preferable and is correct, but is left unclear. A situation that raises questions about method 1 id if the first <FOO> element has different attributes than the second one. Should the element then be removed? Also if the second element has event listeners and the first one did not have the same event listeners the events would be lost. Please clarify this situation.Jeff Yatese-mail: PBWiz@PBWizard.comHomepage: http://www.PBWizard.com
Received on Friday, 16 March 2001 14:05:53 UTC