Bug 1012231 - Make inline history more efficient when inserting elements
Summary: Make inline history more efficient when inserting elements
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Bugzilla
Classification: Community
Component: User Interface
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: ---
Assignee: Simon Green
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-26 04:25 UTC by Simon Green
Modified: 2014-10-12 22:51 UTC (History)
2 users (show)

Fixed In Version: 4.4.0009
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-04 00:46:23 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Mozilla Foundation 920525 0 None None None Never
Mozilla Foundation 921133 0 None None None Never

Description Simon Green 2013-09-26 04:25:16 UTC
(another bmo side port)

Now that I've looked into the Bugzilla code (https://bugzilla.mozilla.org/extensions/InlineHistory/web/inline-history.js) my suspicion in comment 8 seems correct:

>          var itemHtml =  '<div class="ih_history_item ' + containerClass + '" '
>                          + 'id="h' + i + '">'
>                          + item[3]
>                          + '<div class="ih_history_change">' + item[2] + '</div>'
>                          + '</div>';
>
>          if (ih_activity_sort_order == 'oldest_to_newest') {
>            currentDiv.innerHTML = currentDiv.innerHTML + itemHtml;
>          } else {
>            currentDiv.innerHTML = itemHtml + currentDiv.innerHTML;
>          }

This is being done for each single history item and in case of bug 705294 currentDiv is always the same element (there is only one comment so all history items are being inserted into the same place). Each time an item is being added the HTML code for the entire block (including all the previously added items) has to be reparsed. The most trivial way to avoid this issue would be replacing the code above by one that doesn't touch already existing elements:

>          var item = document.createElement("div");
>          item.className = "ih_history_item " + containerClass;
>          item.id = "h' + i;
>          item.innerHTML = item[3] + '<div class="ih_history_change">' + item[2] + '</div>';
>
>          if (ih_activity_sort_order == 'oldest_to_newest') {
>            currentDiv.appendChild(item);
>          } else {
>            currentDiv.insertChild(item, currentDiv.firstChild);
>          }

Comment 3 Simon Green 2013-10-04 00:46:23 UTC
This change is now live. If there are any issues, do not reopen this bug.
Instead, you should create a new bug and reference this bug.

  -- simon


Note You need to log in before you can comment on or make changes to this bug.