Problem/Motivation
Just updated Gin to RC1 - congrats to this great step Sascha - but unfortunately, we're getting some javascript observer exception in the browser which doesn't seem to do any harm normally, but Cypress fails with an exception I had never seen before: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
There is also the following stacktrace available:
This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
at <unknown> (https://www.example.com/themes/contrib/gin/dist/js/sticky.js?rm3ryk:10:12)
at Array.forEach (<anonymous>)
at Object.attach (https://www.example.com/themes/contrib/gin/dist/js/sticky.js?rm3ryk:4:78)
at <unknown> (https://www.example.com/core/misc/drupal.js?v=9.4.8:27:24)
at Array.forEach (<anonymous>)
at Drupal.attachBehaviors (https://www.example.com/core/misc/drupal.js?v=9.4.8:24:34)
at HTMLUListElement.<anonymous> (https://www.example.com/core/misc/ajax.js?v=9.4.8:569:20)
at Function.each (https://www.example.com/core/assets/vendor/jquery/jquery.min.js?v=3.6.0:2:3003)
at S.fn.init.each (https://www.example.com/core/assets/vendor/jquery/jquery.min.js?v=3.6.0:2:1481)
at Drupal.AjaxCommands.insert (https://www.example.com/core/misc/ajax.js?v=9.4.8:567:21)
Downgrading to beta5 solves the problem. Not sure if the above information is enough to find the issue. If you need any more information, I'm happy to investigate.
Issue fork gin-3324320
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
saschaeggiHey @jurgenhaas
We removed jQuery a while ago in the dev branch and moved to use vanilla JS. We also did some refactoring and indeed use an Observer. There is no way to remove the Observer.
If you can provide a patch to make it work with Cypress I'm happy to review & merge.
Comment #4
jurgenhaasAs you can most certainly tell from the code in MR 201, I'm not a javascript expert. But at least that change resolves the problem as it verifies, if
context.querySelector(".region-sticky-watcher")
returns an element before using it with the observer.Comment #5
saschaeggi@jurgenhaas the MR is missing source file(s).
Comment #6
jurgenhaasI wish I knew what I'm doing ;-) Please have another look.
Comment #8
saschaeggiFixed 🎉
Comment #9
jurgenhaasThanks you !!!