Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / toolbar / js / views / MenuVisualView.es6.js
index e956112aafb204c60a9ac34849e98919aa045394..108f65c4261a655433f0119b5946e13685da2a70 100644 (file)
     render() {
       const subtrees = this.model.get('subtrees');
       // Add subtrees.
-      for (const id in subtrees) {
-        if (subtrees.hasOwnProperty(id)) {
-          this.$el
-            .find(`#toolbar-link-${id}`)
-            .once('toolbar-subtrees')
-            .after(subtrees[id]);
-        }
-      }
+      Object.keys(subtrees || {}).forEach((id) => {
+        this.$el
+          .find(`#toolbar-link-${id}`)
+          .once('toolbar-subtrees')
+          .after(subtrees[id]);
+      });
       // Render the main menu as a nested, collapsible accordion.
       if ('drupalToolbarMenu' in $.fn) {
         this.$el