##// 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 282 var target_line = $('#' + lineid).get(0);
283 283 var comment = new $(tableTr('inline-comments', html));
284 284 // check if there are comments already !
285 var parent_node = target_line.parentNode;
286 var root_parent = parent_node;
287 while (1) {
288 var n = parent_node.nextElementSibling;
289 // next element are comments !
290 if ($(n).hasClass('inline-comments')) {
291 parent_node = n;
285 if (target_line) {
286 var parent_node = target_line.parentNode;
287 var root_parent = parent_node;
288
289 while (1) {
290 var n = parent_node.nextElementSibling;
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 {
294 break;
299 // put in the comment at the bottom
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 308 return target_line;
306 309 };
General Comments 0
You need to be logged in to leave comments. Login now