Fixed 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:
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.11).

Change log:
Strip the leading # from cleanedHash so getElementById resolves the target
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom