0

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?

James Allardice
  • 164,175
  • 21
  • 332
  • 312
qwertymk
  • 34,200
  • 28
  • 121
  • 184

3 Answers3

3

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.

gion_13
  • 41,171
  • 10
  • 96
  • 108
  • Actually, pushState is a new browser history method, that allows you to manually manipulate the history and store the state of the browser. https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#The_pushState().C2.A0method – Wil Mar 30 '12 at 12:51
  • @WilliamGolden Sorry for the confusion, but I was only referring to the second point in the question; the one with `location.hash`. See update. – gion_13 Mar 30 '12 at 13:23
1

document.hash does not exists, you can access the hash by document.location.hash. The get_fragment function seems to do the same thing. I'm guessing the author used a custom function because he didn't knew about document.location.hash.

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

This adds the function to the jq_bbq namespace/object and also allows referencing it with the local variable jq_bbq_pushState.

Willem D'Haeseleer
  • 19,661
  • 9
  • 66
  • 99
  • `jq_bbq.pushState` one's global and one's local? Also Ben def knew about `location.hash` – qwertymk Mar 30 '12 at 12:21
  • It's not global, unless bbq is a reference to window, but i don't think that. ( i'm just deducting this from the code, i do not know the framework ) This might be the result of wanting to expose a private function trough the jq_bbq namespace. – Willem D'Haeseleer Mar 30 '12 at 12:25
-1

Well, you could use a plugin if needed. In WordPress look for the Plugins section and under "Add New" you can do a search for alternatives. Here is a sample result https://bestgrill.reviews/best-wood-pellet-grills/. You may be able to find a plugin to help you with your problem.

Helmut Granda
  • 4,565
  • 7
  • 35
  • 51