Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
handleClick()
, root state initialization, setting up event listeners, onpopstate()
, Drupal Ajax object creation … they would all benefit from being grouped together into a Controller
object.
(I realized this thanks to #2713549-4: Refactor onhashchange event handler away: simplicity, consistency, and avoids a whole class of potential problems with JS using hash-based routing.)
Comment | File | Size | Author |
---|---|---|---|
#7 | 2713567-7.patch | 27.22 KB | Wim Leers |
Comments
Comment #2
Wim LeersComment #3
Wim LeersFirst step.
Comment #4
Wim LeersSplit out into:
HistoryBasedNavigation
ClickBasedNavigation
Controller
There is unfortunately one regression: when using the "back" button, the scroll position is no longer being restored… deity knows why :(
Comment #5
Wim LeersTurns out this regression was introduced in #2713549: Refactor onhashchange event handler away: simplicity, consistency, and avoids a whole class of potential problems with JS using hash-based routing! So it'll be up to that issue to fix it.
Comment #6
Wim LeersChanges:
Comment #7
Wim LeersFix eslint errors.
Comment #9
Wim Leers