Menu

#468 cloneNode drops id attributes

closed
None
5
2012-10-21
2007-04-25
No

On FF and IE, DomNode.cloneNode() clones the node exactly, whereas HtmlUnit sets the "id" attribute to "".

There are tests to make sure this happens, but the tests were added in the same commit as the code that drops the id values.

I can't find anything to suggest why the id attributes should be dropped (although a tracker number in the commit message would have helped).

Attached html file can be loaded in a real browser to show its behaviour.

Attached patch fixes src, adds test for same id value in clone, and removed incorrect tests.

Discussion

  • Bruce Chapman

    Bruce Chapman - 2007-04-25

    Verify real browser behaviour

     
  • Bruce Chapman

    Bruce Chapman - 2007-04-25
     
  • Bruce Chapman

    Bruce Chapman - 2007-04-25

    Logged In: YES
    user_id=1750644
    Originator: YES

    File Added: clonedropsids.diff

     
  • Daniel Gredler

    Daniel Gredler - 2007-04-29

    Logged In: YES
    user_id=1109422
    Originator: NO

    I don't know why the id was being explicitly removed, but it doesn't match browser behavior, so I've committed the necessary changes to SVN. Thanks!

     

Log in to post a comment.