leaguevine / leaguevine-ultistats

MIT License
18 stars 4 forks source link

Ultistats doesn't render in mobile browsers #12

Closed mliu7 closed 12 years ago

mliu7 commented 12 years ago

Everything works fine on desktop browsers, but nothing renders on mobile browsers. There seems to be a problem with the render function in Backbone.LayoutManager.

mliu7 commented 12 years ago

Just want to elaborate on this and share thoughts.

The solution I used for this was to remove the "use strict"; tag at the top of the LayoutManager file. "use strict" is a relatively new feature to Javascript that essentially does extra checking for dangerous or invalid code. See this SO answer:

http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it

The reason I removed this is because in the safari mobile browser, I noticed that when the layoutmanager render() method was called for the team list page, nothing was happening. I placed a 'debugger' keyword in the layoutmanager's render function and using a debugging console noticed that there was an error at the point of the debugger that said there was a syntax error at line 1. I assumed this meant "use strict"; was the syntax error, but this may not have been the case.

It may have been throwing the error because some other part of the file had a syntax error and the "use strict" was catching the error but without the "use strict" option the syntax error fell through the cracks and passed ok.

It's strange that this only happens on mobile safari and other mobile browsers but not on desktop browsers.

I'm willing to re-open the issue and find a different way around the problem than removing "use strict" if someone thinks it's important to have.