My favorites | Sign in
Project Home Downloads
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 453: DynaTreeNode.remove throws an exception if the node isn't rendered
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Oct 2013


 
Reported by alkol...@gmail.com, Sep 6, 2013
To reproduce:
1. Collapse a parent node
2. Call 'remove' for any child node and insert the same node again
3. Repeat step 2
'remove' method throws an error. In Chrome the error is:

Error: An attempt was made to reference a Node in a context where it does not exist.
at Object.DynaTreeNode.removeChild (http://dynatree.googlecode.com/svn/trunk/src/jquery.dynatree.js:1471:12)

In other browsers the error can be different.

jsFiddle: http://jsfiddle.net/tNcEJ/11/

Problem code - removeChild method, line 1437:
		if(this.ul){
//			$("li", $(this.ul)).remove(); //  issue 399 
			this.ul.removeChild(tn.li); //  issue 402 
		}
Replace with:
		if(this.ul && tn.li){
			this.ul.removeChild(tn.li); //  issue 402 
		}

I suppose you need to do the same thing in removeChildren method to fix  issue 231 . At least move $("li", $(this.ul)).remove() out of the 'for' cycle, no need to remove all li nodes at each iteration.

Dynatree version: 1.2.4
Sep 6, 2013
Project Member #1 moo...@wwwendt.de
(No comment was entered for this change.)
Status: Accepted
Labels: Milestone-Release1.2.5
Sep 7, 2013
Project Member #2 moo...@wwwendt.de
This issue was updated by revision r677.
Sep 7, 2013
Project Member #3 moo...@wwwendt.de
could you please verify?
Status: Waiting
Sep 25, 2013
#4 alkol...@gmail.com
Works great, thanks! Please excuse me for a long delay.
What about the same fix in removeChildren method?
Oct 3, 2013
Project Member #5 moo...@wwwendt.de
(No comment was entered for this change.)
Status: Accepted
Oct 6, 2013
Project Member #6 moo...@wwwendt.de
This issue was closed by revision r682.
Status: Fixed

Powered by Google Project Hosting