2.2 regession: XF._IgnoredWatcher.initializeHash does not work es expected

Kirby

Well-known member
Licensed customer
Affected version
2.3.10
If the location hash points to ignored content, this content should be unhidden so scrolling works correctly.

This does not work in XenForo 2.3 due to a bug that was introduced when removing jQuery.

XenForo 2.2 JS
Code:
initializeHash: function()
{
    if (window.location.hash)
    {
        var cleanedHash = window.location.hash.replace(/[^\w_#-]/g, '');
        if (cleanedHash === '#')
        {
            return;
        }

        var $jump = $(cleanedHash),

XenForo 2.3 JS
Code:
initializeHash ()
{
    if (window.location.hash)
    {
        const cleanedHash = window.location.hash.replace(/[^\w_#-]/g, '')
        if (cleanedHash === '#')
        {
            return
        }

        const jump = document.getElementById(cleanedHash)

The vanilla JS code requires that cleanedHash does not contain the # to make getElementById successful.
 
Last edited:
Back
Top Bottom