diff -u b/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js --- b/core/modules/toolbar/js/toolbar.js +++ b/core/modules/toolbar/js/toolbar.js @@ -49,6 +49,9 @@ $toolbar = $(context).find('#toolbar-administration').once('toolbar'); if ($toolbar.length) { // Add subtrees. + // @todo Optimize this to delay adding each subtree to the DOM until it is + // needed; however, take into account screen readers for determining + // when the DOM elements are needed. if (Drupal.toolbar.subtrees) { for (var id in Drupal.toolbar.subtrees) { $('#toolbar-link-' + id).after(Drupal.toolbar.subtrees[id]); diff -u b/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module --- b/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -240,7 +240,11 @@ '#heading' => t('Administration menu'), ); - // @todo Add a comment explaining this. + // To conserve bandwidth, we only include the top-level links in the HTML. + // The subtrees are included in a JSONP script, cached by the browser. Here we + // add that JSONP script. We add it as an external script, because it's a + // Drupal path, not a file available via a stream wrapper. + // @see toolbar_subtrees_jsonp() $menu['toolbar_administration']['#attached']['js'][url('toolbar/subtrees/' . _toolbar_get_subtree_hash())] = array('type' => 'external'); $items['administration'] = array(