Problem/Motivation

olivero uses D6 style code for tagging processed elements to not depend on jQuery.

Proposed resolution

use the new vanillajs once library.

CommentFileSizeAuthor
#2 core-once-olivero-3183094-2.patch9.63 KBnod_

Comments

nod_ created an issue. See original summary.

nod_’s picture

StatusFileSize
new9.63 KB
mherchel’s picture

Status: Postponed » Needs review
nod_’s picture

Issue tags: +Needs tests

if test passes it means there are no tests since this patch doesn't ship the new once library used in the JS.

droplet’s picture

+++ b/core/themes/olivero/olivero.libraries.yml
@@ -56,12 +56,14 @@ global-styling:
   dependencies:
     - core/drupal
+    - core/once
+    - core/drupal.element.matches
+    - core/drupal.nodelist.foreach

I surprised it won't trigger errors.

+++ b/core/themes/olivero/js/messages.js
@@ -5,7 +5,7 @@
     var messageContainer = message.querySelector('.messages__container');

BTW, this theme has a lot of such usages. That assumed CLASS as ID. I think it's not so good.

nod_’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3173900: Refactor Olivero's JavaScript Drupal behaviors to use once()