Jump to content

Javascript same/different???


Dirty Butter

Recommended Posts

It's taken me quite a while to track down an issue in our sites that are on the current commit from GitHub for 6.1.2. All the js files are stock. But I kept getting the throbber on the admin Dashboard. I wasted a lot of time checking all my files I knew would have differences, but nothing stopped the throbber.

I finally realized that there IS something different about the javascript in jquery.filetree.min.js - but I can't SEE it. If I ftp this file from one site to another - I get the throbber. If I overwrite the throbbing site with the js from the commit - it stops throbbing and the site works. These two files LOOK ALIKE, but see below what BeyondCompare thinks of them.

Pink lines are different??????

javascriptequalproblem.jpg

Could someone explain this to me?

Link to comment
Share on other sites

I think your file compare utility does not have "Ignore whitespace" enabled. Also, I think it does not have "Show whitespace" enabled.

When Show whitespace is enabled, tabs and spaces will be indicated by some kind of symbol. I have seen right-pointed arrows and right chevrons for tabs, and underscores and center-dots for spaces.

These lines, which otherwise look identical, may have spaces vs tabs differences. If you look at the very bottom of the window, you will see the spaces that have replaced a tab.

 

Link to comment
Share on other sites

OK, found the setting to show whitespaces. There ARE differences in spacing and tabs. I see that now that you pointed it out. But normally BC shows that kind of difference in BLUE.

So js must be much stricter about such things?

The stock from the master js file works when I ftp it to a store. But the copy of the file from one store to another does not.

So these spacing variations appear to make a big difference.

Link to comment
Share on other sites

Spaces/tabs that are "leading", in that their sole function is to "pretty print" the indentation, making the code more parsable by human eyes, do not affect javascript code in any way. Minimized code will always strip all that out, therefore leading whitespace has no effect.

We will need to look elsewhere for the difference.

If the throbber doesn't go away, then javascript has crashed (assuming the entity at the other end doesn't crash).

Launch Firebug and see if there are any messages on the Console tab.

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...