diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 16:56:03 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 16:56:03 +0000 |
commit | 455234153453e321e89581e3b48e5af91a021089 (patch) | |
tree | a9f664393b2eda2a1eb29ef43bafb266187f274e /chrome | |
parent | a2a51366fbd0db1d106ad91fdf80425e24c2f951 (diff) | |
download | chromium_src-455234153453e321e89581e3b48e5af91a021089.zip chromium_src-455234153453e321e89581e3b48e5af91a021089.tar.gz chromium_src-455234153453e321e89581e3b48e5af91a021089.tar.bz2 |
Makes new tab page update properly when its told bookmarks are
changed.
BUG=1861
TEST=see bug
Review URL: http://codereview.chromium.org/1618
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/resources/new_tab.html | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/resources/new_tab.html b/chrome/browser/resources/new_tab.html index a49901b..2b90255 100644 --- a/chrome/browser/resources/new_tab.html +++ b/chrome/browser/resources/new_tab.html @@ -373,6 +373,7 @@ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded); <div id="recentlyBookmarked" class="sidebar" style="display:none"> <span class="section-title" jscontent="bookmarks"></span> + <div id="recentlyBookmarkedContainer"></div> </div> <div id="recentlyClosedTabs" class="sidebar" style="display:none"> @@ -537,10 +538,16 @@ function renderSearchURLs(urls) { attributes. */ function renderRecentlyBookmarked(entries) { logEvent('renderRecentlyBookmarked called: ' + entries.length); - var container = document.getElementById('recentlyBookmarked'); + var section = document.getElementById('recentlyBookmarked'); + var container = document.getElementById('recentlyBookmarkedContainer'); + + /* recentlyBookmarked is called any time the bookmarks change. Remove existing + entries before adding new ones. */ + section.style.display = 'none'; + container.innerHTML = ''; if (entries.length > 0) { - container.style.display = 'block'; + section.style.display = 'block'; for (var i = 0, entry = entries[0]; entry = entries[i]; ++i) { var link = DOM('a', {href: entry.url, className:'recent-bookmark', title:entry.title}); link.style.backgroundImage = @@ -564,9 +571,7 @@ function renderRecentlyClosedTabs(entries) { date. Therefore, reset the recentlyClosedTabs state on every call. */ section.style.display = 'none'; - while(container.hasChildNodes()) { - container.removeChild(container.firstChild); - } + container.innerHTML = ''; if (entries.length > 0) { section.style.display = 'block'; |