Export to GitHub

dynatree - issue #495

TypeError: parent.li is (sometimes) null at line 411


Posted on Feb 11, 2015 by Massive Bear

What steps will reproduce the problem? 1. Called activate() on a node, but only fails 25% of the time

What is the expected output? What do you see instead? In the Firefox console:

"13:19:24.743 - bind(" Object { originalEvent: click, type: "click", isDefaultPrevented: returnFalse(), timeStamp: 139497805, jQuery19102235185644524572: true, toElement: undefined, screenY: 752, screenX: 117, pageY: 650, pageX: 112, 22 more… } "): dtnode: " Object { parent: Object, tree: Object, data: Object, li: <li>, span: <span.dynatree-node.dynatree-exp-c.dynatree-ico-c.dynatree-focused>, ul: null, childList: null, _isLoading: false, hasSubSel: false, bExpanded: false, 1 more… } ", error: " TypeError: parent.li is null Stack trace: DynaTreeNode.prototype.render@http://localhost:8162/dynatree/jquery.dynatree.js:411:6 storeNode@http://localhost:8162/tree-ui.js:432:35 initTree/<.onQueryActivate@http://localhost:8162/tree-ui.js:77:6 DynaTreeNode.prototype._activate@http://localhost:8162/dynatree/jquery.dynatree.js:843:47 DynaTreeNode.prototype.activate@http://localhost:8162/dynatree/jquery.dynatree.js:889:3 DynaTreeNode.prototype._userActivate@http://localhost:8162/dynatree/jquery.dynatree.js:928:4 DynaTreeNode.prototype._onClick@http://localhost:8162/dynatree/jquery.dynatree.js:1262:4 .bind/<@http://localhost:8162/dynatree/jquery.dynatree.js:3000:84 jQuery.event.dispatch@http://localhost:8162/bootstrap/js/jquery/js/jquery-1.9.1.js:3073:15 jQuery.event.add/elemData.handle@http://localhost:8162/bootstrap/js/jquery/js/jquery-1.9.1.js:2750:6 jquery.dynatree.js:54

What version of the dynatree and jQuery are you using? dynatree 1.2.6 jQuery 1.9.1 jQuery-UI 1.10.3

On what operating system and browser? Mac OS X 10.10.2, Firefox 35.0.1

What DOCTYPE declaration are you using? <!DOCTYPE html>

Please provide any additional information below.

activate() is being called by an onClick event from an "<a>" link. When onQueryActivate() fires with the second argument 'true', my code does some validation work that takes a few milliseconds before deciding if it's ok to return true. The error only occurs when that returns true of course, since the node wouldn't activate otherwise. Since it happens somewhat randomly, it sounds like a timing/thread problem?

Comment #1

Posted on Feb 12, 2015 by Happy Bear

Seems you are triggering the render function inside onQueryActivate(?). Can you post the code of that event handler (or even better set up a jsFiddle that reproduces the problem)?

Comment #2

Posted on Mar 29, 2015 by Happy Bear

Moved to GitHub: https://github.com/mar10/dynatree/issues/495

Status: Done

Labels:
Type-Defect Priority-Medium