javascriptjqueryhashchangejquery-bbq

jQuery bbq... where's the grill?


I was looking at the jQuery bbq plugin, and couldn't find any mention of document.hash anywhere in his code.

I assume getting the hash is at line 1094:

function get_fragment( url ) {
    url = url || location.href;
    return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
};

And setting the hash at 818 But why use those instead of location.hash ?

Also what's the deal with this:

jq_bbq.pushState = jq_bbq_pushState = function( params, merge_mode ) {

Wouldn't jq_bbq_pushState = function... be enough?


Solution

  • Regarding your second point - the one with location.hash- I can't tell for sure, but earlier versions of browsers might have had problems with location.hash.
    My guess is that the author needed to rely on the hash property so he implemented his own.
    If you search google for ie6 location.hash you wouldn't have to dig for information to see that there are many complains.