Menu

#131 DomNode.replace() fails to set previousSibling on newNode

closed
None
5
2012-10-21
2004-04-07
No

DomNode.replace() fails to connect the previousSibling
pointer for newNode, which later causes an
IllegalArgumentException to be thrown at the beginning
of the method if the child is replaced later.

The attached patch fixes this issue.

Failing unit tests will be uploaded tomorrow.

Discussion

  • David D. Kilzer

    David D. Kilzer - 2004-04-07

    Fix DomNode.replace() to set previousSibling on newNode

     
  • David D. Kilzer

    David D. Kilzer - 2004-04-07

    Logged In: YES
    user_id=84089

    Here is a group of tests to demonstrate the problems with
    DomNode.replace().

    I managed to reduce the HTML for the test case, but didn't
    have time to reduce the JavaScript.

    I will upload the actual JavaScript files and the HTML file
    next.

     
  • David D. Kilzer

    David D. Kilzer - 2004-04-07

    First JavaScript file

     
  • David D. Kilzer

    David D. Kilzer - 2004-04-07

    Second Javascript file

     
  • David D. Kilzer

    David D. Kilzer - 2004-04-07

    HTML test file

     
  • Marc Guillemot

    Marc Guillemot - 2004-12-16

    Logged In: YES
    user_id=402164

    Can the js be - strongly - reduced?

    If not, we have to look for a solution adding the js files
    as it and loading them for the classpath because such a js
    code in java string is quite unreadable and makes difficult
    to use it for tests in a real browser.

     
  • Marc Guillemot

    Marc Guillemot - 2004-12-17

    Logged In: YES
    user_id=402164

    I can reproduce the bug with a small unit test and solve it
    as proposed in your patch.
    I've found many other bugs related to the DomNode and it may
    take a few days before I can commit all the fixes.

     
  • Marc Guillemot

    Marc Guillemot - 2004-12-17

    Logged In: YES
    user_id=402164

    Should be now fixed in CVS. Thanks.

     
  • David D. Kilzer

    David D. Kilzer - 2004-12-17

    Logged In: YES
    user_id=84089

    Thanks for writing a new test case, Mark.

    When I wrote the original, I tried to reduce the voluminous JavaScript we
    were using to swap table rows using the DOM, but (as you saw) I was
    not very successful. :)

     
  • David D. Kilzer

    David D. Kilzer - 2004-12-17

    Logged In: YES
    user_id=84089

    Thanks, MARC! Sorry for mispelling your name.

     

Log in to post a comment.