##// END OF EJS Templates
js: add check to eliminate js errors when inline comment function references an object which does not exist
lisaq -
r695:bbba5e47 default
parent child Browse files
Show More
@@ -282,25 +282,28 b' var placeInline = function(target_contai'
282 var target_line = $('#' + lineid).get(0);
282 var target_line = $('#' + lineid).get(0);
283 var comment = new $(tableTr('inline-comments', html));
283 var comment = new $(tableTr('inline-comments', html));
284 // check if there are comments already !
284 // check if there are comments already !
285 var parent_node = target_line.parentNode;
285 if (target_line) {
286 var root_parent = parent_node;
286 var parent_node = target_line.parentNode;
287 while (1) {
287 var root_parent = parent_node;
288 var n = parent_node.nextElementSibling;
288
289 // next element are comments !
289 while (1) {
290 if ($(n).hasClass('inline-comments')) {
290 var n = parent_node.nextElementSibling;
291 parent_node = n;
291 // next element are comments !
292 if ($(n).hasClass('inline-comments')) {
293 parent_node = n;
294 }
295 else {
296 break;
297 }
292 }
298 }
293 else {
299 // put in the comment at the bottom
294 break;
300 $(comment).insertAfter(parent_node);
301 $(comment).find('.comment-inline').addClass('inline-comment-injected');
302 // scan nodes, and attach add button to last one
303 if (show_add_button) {
304 placeAddButton(root_parent);
295 }
305 }
296 }
306 }
297 // put in the comment at the bottom
298 $(comment).insertAfter(parent_node);
299 $(comment).find('.comment-inline').addClass('inline-comment-injected');
300 // scan nodes, and attach add button to last one
301 if (show_add_button) {
302 placeAddButton(root_parent);
303 }
304
307
305 return target_line;
308 return target_line;
306 };
309 };
General Comments 0
You need to be logged in to leave comments. Login now