Fixed Javascript error on xfInsert


Well-known member

There are some users might experience with javascript error on xfInsert event. This might occur on new reply or after inline-edit the post. The post disappear but could not be shown again.

The javascript console would show:

NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMWindow.getComputedStyle]


This kind of error does not occur on all browsers, this might cause by jQuery library or conflict with another library.

After investigate I see that in XF source code:
xfInsert: function(insertMethod, insertReference, animateMethod, animateSpeed, callback)
            if (insertMethod == 'replaceAll')
                [insertMethod || 'appendTo'](insertReference)
                [animateMethod || 'xfFadeDown'](animateSpeed, callback);
            return this;

You could see that XF would hide the element first then later use fadeDown function to use show up animation.

This could be easy resolved by change
hide() to .css('display', 'none)

This is strange since hide() function is shortcut to set css display property to none. But I think in the next version, we should use css('display', 'none) instead of hide() to avoid this kind of problem.
maybe it's something they will fix when they will use a newer jquery library, most likely not in a minor release as 1.1.x. More likely in a 1.x release.
Neither liking nor bumping bug reports is necessary.

They will all be dealt with in due course.
I think this change should be ok - the animate function has various code in it to determine which display to move to. Though if someone had a consistent reproduction case, that'd be helpful.
Top Bottom