This topic was marked solved by live627, on March 20th, 2013, 12:47 AM

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
reqWin / weUrl / jQuery bug?
« on March 18th, 2013, 07:29 PM »
For example, http://wedge.org/pub/feats/7698/calendar/ - the active members plugin has a 'more' link.

This ultimately turns into the following deferred event:
Code: [Select]
reqWin(weUrl('action=activemembers;topic=7698'), 500); return false;

Which generates:
Quote
Syntax error, unrecognized expression: http://wedge.org/?action=activemembers;topic=7698 jquery-2.0.0b1.min.js:2
So the weUrl part is fine, but something about the way it's passed to reqWin causes jQuery to get very upset. Since the plugin and - as far as I know, reqWin in general - hasn't changed in how it's accessed, I see no reason why this should be a problem...
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: reqWin / weUrl / jQuery bug?
« Reply #2, on March 18th, 2013, 10:37 PM »
Sorry -- won't be able to test until tomorrow morning, in the end. Too tired for tonight. :(
Re: reqWin / weUrl / jQuery bug?
« Reply #3, on March 19th, 2013, 09:23 AM »
So, I worked a bit on this this morning, and it's really odd... It fails at from && from.href, and it does too in jQuery 1.9, so it might be a Chrome bug, but right now I'm using Sleipnir, which is based on Chrome 22, and thus a rather old version, so I guess if it wasn't fixed in the meantime, it's... not a Chrome bug..??!
Very strange.

I don't want to have to do a fix that takes too many bytes. I have to get to the bottom of this... :-/
Re: reqWin / weUrl / jQuery bug?
« Reply #4, on March 19th, 2013, 09:53 AM »
Okay... Fixed :eheh:

Wasn't due to the first line, but the second. (Chrome led me into thinking it was the first.)
i.e., $(from).text(). I optimized that line to that size specifically because jQuery was ignoring URLs fed to it, so $('http://...') would just be ignored. Now it seems (in 1.9+) to generate an error. More specifically, the ':' is the one that causes the crash.

So, I just added the same test before it, and it works. It adds an exact 3 bytes to the code.
Then I removed a hack that was just a few lines below, which I'd forgotten to do -- I'd added a 'note to self' to remove it once we'd go for jQuery 1.8. Saves 9 bytes. And finally, I removed another hack for something that caused problems last week, but seems to be working now, probably the result of another fix I added in the meantime... I don't know. I don't care.

All in all, the script.js bytesize is now 7 bytes shorter, and works better. Thanks, Pete! ;)