Vanilla js conversion#1318
Draft
trubach wants to merge 7 commits into
Draft
Conversation
…move jQuery Converted all theme JavaScript to vanilla JS using Drupal.behaviors + once(), and removed jQuery as a dependency. Converted (14 files -> Drupal.behaviors.<name> + once(id, selector, context), vanilla DOM): - Simple attr/class: paragraph-icon-row, -feature-group, -rt, -content-slider, -card, -image-gallery, -calendar, -list-content, -cta-narrow, -vertical-tab (removeAttr/attr/removeClass -> removeAttribute/setAttribute/classList). - With logic: paragraph-bb (matchMedia padding + resize bound once), paragraph-contact (captures [reverse] els, toggles on resize), paragraph-whitespace (sibling traversal via nextElementSibling/classList), google-cse (script injection guarded by once, reads drupalSettings). - table-mobile.js was already converted on the base branch. illinois_framework_theme.libraries.yml: - Removed all core/jquery dependencies (6 libraries). - Added explicit core/drupal + core/once to every library running a converted behavior. - Kept core/drupalSettings for google-cse and skipto-campus. Verification: - node --check passes on all 15 JS files. - libraries.yml validates as YAML. - Theme-wide sweep confirms zero remaining jQuery / $( / core/jquery. Notes: - paragraph-whitespace.js is an orphan (not referenced in libraries.yml); converted for completeness but not wired up - a pre-existing condition. - External libs (Toolkit web-components, SkipTo, ils-*) are vanilla and don't require jQuery. - Changes take effect after a cache rebuild (drush cr). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Fixes #1317
Converted all theme JavaScript to vanilla JS using
Drupal.behaviors+once(), and removed jQuery as a dependency.Converted (14 files ->
Drupal.behaviors.<name>+once(id, selector, context), vanilla DOM)paragraph-icon-row,-feature-group,-rt,-content-slider,-card,-image-gallery,-calendar,-list-content,-cta-narrow,-vertical-tab(removeAttr/attr/removeClass->removeAttribute/setAttribute/classList).paragraph-bb(matchMedia padding + resize bound once),paragraph-contact(captures[reverse]els, toggles on resize),paragraph-whitespace(sibling traversal vianextElementSibling/classList),google-cse(script injection guarded byonce, readsdrupalSettings).table-mobile.jswas already converted on the base branch.illinois_framework_theme.libraries.ymlcore/jquerydependencies (6 libraries).core/drupal+core/onceto every library running a converted behavior.core/drupalSettingsforgoogle-cseandskipto-campus.Verification
node --checkpasses on all 15 JS files.libraries.ymlvalidates as YAML.jQuery/$(/core/jquery.Notes
paragraph-whitespace.jsis an orphan (not referenced inlibraries.yml); converted for completeness but not wired up - a pre-existing condition.drush cr.✅ Peer Review Checklist
Reviewers: Please verify the following before approving.
t(), Twig auto-escaping, etc.). No secrects included (API keys, etc.)ksm(),dpm(),console.log) has been removed.📸 Screenshots / Video (Optional)
If this is a UI change, please attach a screenshot or a quick screen recording of the change in action.