Skip to content

Commit 2af1282

Browse files
committed
woohoo jQuery closest() eliminated this nasty 2-year-old hack
1 parent 26da38c commit 2af1282

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎v3/js/pytutor.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,10 +2740,8 @@ ExecutionVisualizer.prototype.renderDataStructures = function(curEntry, curTople
27402740

27412741
function highlight_frame(frameID) {
27422742
myViz.jsPlumbInstance.select().each(function(c) {
2743-
// this is VERY VERY fragile code, since it assumes that going up
2744-
// FOUR layers of parent() calls will get you from the source end
2745-
// of the connector to the enclosing stack frame
2746-
var stackFrameDiv = c.source.parent().parent().parent().parent();
2743+
// find the enclosing .stackFrame ...
2744+
var stackFrameDiv = c.source.closest('.stackFrame');
27472745

27482746
// if this connector starts in the selected stack frame ...
27492747
if (stackFrameDiv.attr('id') == frameID) {

0 commit comments

Comments
 (0)