1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Javascript error on xfInsert

Discussion in 'Resolved Bug Reports' started by sonnb, Sep 21, 2012.

  1. sonnb

    sonnb 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:

    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.
    Marcus likes this.
  2. Luân Vũ

    Luân Vũ Member

    As you can see in the source of jQuery 1.5.0: http://james.padolsey.com/jquery/#v=1.5.0&fn=hide
    the $.fn.hide method not only set the style display of elements to none, but also save their old display.
    I think it's good for $.fn.show method to set the property display to exact value!
  3. Marcus

    Marcus Well-Known Member

  4. sonnb

    sonnb Well-Known Member

    It's odd but hope Mike would fix this in 1.1.4.
  5. Marcus

    Marcus Well-Known Member

    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.
    sonnb likes this.
  6. HWS

    HWS Well-Known Member

    We also got reports from users about that error.
  7. soloman

    soloman New Member

    me too
  8. shenmuee

    shenmuee Active Member

    +1 me too
  9. Marcus

    Marcus Well-Known Member

    Then let's vote on the first post so our developers know which bugs may have priority.
  10. Brogan

    Brogan XenForo Moderator Staff Member

    Neither liking nor bumping bug reports is necessary.

    They will all be dealt with in due course.
  11. Mike

    Mike XenForo Developer Staff Member

    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.
    Slavik likes this.

Share This Page