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

Fixed Appending #a=1 to a XenForo URL causes a jQuery error

Discussion in 'Resolved Bug Reports' started by Thelo, Jan 23, 2012.

  1. Thelo

    Thelo Member

    If you append a hashmark to a XenForo URL that shows tabs, in such a way that the location.hash includes the equals character '=', such as "#asdf=1234", then go directly to that URL, a javascript error pops up on loading that page.

    For instance, going directly to this URL:
    http://xenforo.com/community/members/kier.2/#asdf=1234

    causes the following error to happen in Google Chrome 17.0.963.26 beta-m:

    1. k.error
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    2. k.filter
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    3. k
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    4. c.querySelectorAll.k
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    5. d.fn.extend.find
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    6. q
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:82​
    7. a.fn.tabs
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:85​
    8. d.extend.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    9. d.fn.d.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    10. a.fn.tabs
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:85​
    11. XenForo.Tabs.__construct
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:259​
    12. XenForo.Tabs
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:259​
    13. c.extend.create
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:191​
    14. c.extend.register.b
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:190​
    15. d.extend.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    16. d.fn.d.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    17. c.extend.register
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:190​
    18. d.event.handle
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    19. d.event.add.k.handle.m
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    20. d.event.trigger
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    21. d.fn.extend.trigger
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    22. d.extend.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    23. d.fn.d.each
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    24. d.fn.extend.trigger
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    25. c.extend.activate
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:191​
    26. c.extend.init
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:187​
    27. (anonymous function)
      /community/js/xenforo/min/xenforo.js?_v=4bb52252:337​
    28. d.extend._Deferred.f.resolveWith
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    29. d.extend.ready
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​
    30. c.addEventListener.y
      ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js:16​

    This error seems related to jQuery Tools tabs, which itself uses the jQuery library. This still happens if I manually use jQuery 1.7.1, the latest jQuery version as of this writing.
     
  2. Thelo

    Thelo Member

    Actually, I've just found a fix for this, it's a bug in jQuery Tools where they forgot to add quotes around an attribute selector:
    https://github.com/jquerytools/jquerytools/pull/596
    https://github.com/neutroncreations/jquerytools/commit/3f29890586b0d7cba0057d2368b7f8ab496d1f61

    Fixing this simply involved finding this in the jquery.tools.min.js file used by Xenforo:
    Code:
    c.find("[href="+location.hash+"]")
    and adding single quotes around the location.hash:
    Code:
    c.find("[href='"+location.hash+"']")
     
    Mike, Fuhrmann and ragtek like this.
  3. Mike

    Mike XenForo Developer Staff Member

    Fixed thanks.
     

Share This Page