Wedge

Public area => Features => The Pub => Features: Forward thinking => Topic started by: Nao on May 6th, 2011, 05:12 PM

Title: jQuery support
Post by: Nao on May 6th, 2011, 05:12 PM
Feature: jQuery support
Developer: Nao
Target: modders, themers, users, geeks
Status: 100% (believed to be complete.)
Comment:

Many SMF mods tend to add jQuery headers to ease their work in the JavaScript department. They would tend to conflict with each other. Add to this various mods that make use of other librairies, and it's become clear that Wedge really needed to have jQuery by default, so as to provide a standard library for all modders.
Wedge offers to load the jQuery library from three different sources: local (if you want to use your own server to provide it and don't mind the extra load on your bandwidth), jQuery CDN or Google CDN. We recommend the Google CDN, which is the most reliable source for providing jQuery. In addition, it always loads fast, and chances are that the library will already be cached on your computer if you tend to visit other websites that also include jQuery from the Google CDN.
We strive to make Wedge compatible with the latest jQuery, but we're currently staying on the 1.5 branch, until they do something about their oversized library. ;)

:edit: They did -- so we're now following the latest branches.
Title: Re: jQuery support
Post by: Nao on January 5th, 2013, 02:49 PM
I noticed today that jQuery released a beta version of v1.9 three weeks ago.
It removes a few features that Wedge uses (such as .hover()), nothing that can't be added back manually or just modified anyway, so that's good, and the uglified (packed) version, once zipped, is about 1KB shorter than version 1.7, which is good.
However, it's still 3KB more than jQuery 1.5... I thought their plans was to release a 'final' version for earlier IE compatibility (i.e. v1.9), and a 'semi-final' version for other browsers (i.e. v2.0), without any of the IE compatibility code. I honestly doubt that the IE compat code is more than a couple of kilobytes when gzipped, so it makes it unlikely that there are any filesize advantages in the end over earlier versions of jQuery. Bummer.
I don't see any bugs arising from the use of v1.5.2 these days, so I'd be tempted to call it quits and leave it at v1.5, but I'd like to get opinions on this.
Of course, 29KB versus 32KB isn't much in the end ('only' 10%), and I'd like to delve into the new features, but I don't know what's best for now.
Title: Re: jQuery support
Post by: Arantor on January 5th, 2013, 03:15 PM
Well, the only thing that strikes me as important is jQuery UI compatibility - when finding jQuery UI, I had to find the right version, specifically an older version, that would work on our version of jQuery.

Keeping with older versions of jQuery isn't likely to generate significant bugs, but it might cause trouble for mod authors just using scripts they've found elsewhere on the net, especially if it expects 1.6+ syntax and functionality regarding .prop() I believe it was called.

/medoes not particularly like JS.
Title: Re: jQuery support
Post by: Nao on January 5th, 2013, 05:04 PM
I have a tendency to like JS more than PHP these days, mostly because the 'reward' is immediate and I've always been into real-time rendering. I'm starting to learn Java btw, I'd be willing to bet you hate that one and you're ready to write a 20-page essay on why I shouldn't bother with it :eheh:

Anyway, right now I don't know... What interested me in jQuery 1.9/2.0 is that the team pretty much promised that it would be the last major version (i.e. if we want to add another feature, we'll just write a plugin for it), which is interesting because it has potentially the widest future market share for jQuery versions.
Title: Re: jQuery support
Post by: Arantor on January 5th, 2013, 06:11 PM
<preaching>I have specific issues with specific bits of Java. The two big things are the broken security model and the way everything is turned into classes, and by extension the way you can have multiple copies of a method with the same name but different call signatures. What you end up with is a series of classes with increasingly ridiculously long names. The consequential 'write once run anywhere' myth doesn't work either.</preaching>

Java has a place, and not just because of the amount of code written in it. But you'll never convince me to run it in the browser, and the fact that I've had to deal with users who can't move Java versions because of code that absolutely depends on 1.4 or 1.5 rather than later versions just irritates >_<

Here endeth the lesson.
Quote
which is interesting because it has potentially the widest future market share for jQuery versions.
That's interesting, actually. I'd be inclined to upgrade to that for future compatibility purposes.
Title: Re: jQuery support
Post by: MultiformeIngegno on January 5th, 2013, 06:17 PM
If you remain with 1.5 now you'll have to upgrade in the future anyway. So maybe upgrading now would save you from this task next, and as said it would help plugin authors (without counting all the questions you would avoid like "why does wedge run an old version of jquery?? Pls update it s00n").
Title: Re: jQuery support
Post by: Arantor on January 5th, 2013, 06:25 PM
No-one's actually noticed except me anyway ;)
Title: Re: jQuery support
Post by: Dragooon on January 5th, 2013, 06:31 PM
Newer versions of jquery have some nice speed improvements plus the plugins are being written for them these days anyway, I'd upgrade now. The size vs speed trade kind of balances out.
Title: Re: jQuery support
Post by: Nao on January 17th, 2013, 07:14 PM
So... It seems that jQuery 1.9 final is out, and 2.0 beta is out too :)

The good news is that v2.0 is around the same size as v1.5.2. When gzipped, it's even actually a bit shorter (by around half a KB). It doesn't support old IEs though, so we'll have to include both versions in our repo, and load v1.9 for IE < 9, which is fine by me. Heck, it's not my bandwidth anyway :P

I'll have to work on finishing the conversion to v2.0, though... I suspect I'll have a lot to do. Especially since v1.6 and v1.7 already changed a lot of things themselves.
Title: Re: jQuery support
Post by: Arantor on January 17th, 2013, 07:56 PM
Fair enough, as long as 1.9 is available for those who don't want/can't use a CDN copy.
Title: Re: jQuery support
Post by: Nao on January 17th, 2013, 09:37 PM
Both versions will be available in CDN anyway...
1.9 = for IE 6,7,8.
2.0 = for everything else.
They promise that 2.0 final will be even smaller :)

I'm interested in seeing how they're gonna handle the torture of wanting to add a new feature and being forced to do it via a plugin because they're not planning to do further major releases after that one... :^^;:
Title: Re: jQuery support
Post by: Arantor on January 17th, 2013, 10:13 PM
Yes... but not everyone will be *using* CDN, that's my point.

I won't use CDN at all, ever, but that's just me being picky. Intranets for example won't necessarily have CDN facilities to make it work.
Title: Re: jQuery support
Post by: godboko71 on January 18th, 2013, 05:17 AM
The largest SMF install is an intranet install which doesn't access the Internet
Title: Re: jQuery support
Post by: Arantor on January 18th, 2013, 05:20 AM
Yup. That's always going to be the case in terms of its size because it has to be self contained, as a result jQuery etc. must be local - and must provide all relevant versions of things.

I haven't compared the install size of SMF and Wedge lately but I suspect it would not be entirely favourable, even if I were to even the playing field by neatening up the languages folder, though that's really a side note in the grand scheme of things - and there are things we can cut if we really need to, though I'd rather have functionality than keeping it small. Just as long as we don't get into the territory that MediaWiki is in; the base installation package is now 68MB of uncompressed files.
Title: Re: jQuery support
Post by: Nao on January 18th, 2013, 05:33 PM
SMF 2.0 = 6.5 MB
SMF 2.1 = 7.2 MB (latest)
Wedge = 11.4 MB (latest)

Also...

I was wondering... Should we use //urls instead of http://urls? This is supported by all browsers, the only situation where it doesn't work is if you're browsing via file://. Other than that, it saves bytes and all. But ultimately, the best way to save bytes is to also do the same on all other URLs... And that's where I'm starting to wonder and wander...

So, yeah, I updated the jQuery URLs to use the https protocol if the current website is running on https.
At least THAT is done. :P
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 09:18 AM
Quote from Nao on January 17th, 2013, 09:37 PM
I'm interested in seeing how they're gonna handle the torture of wanting to add a new feature and being forced to do it via a plugin because they're not planning to do further major releases after that one... :^^;:
Some people say they'll just release a version 1.10 for IE and 2.1 for non-IE, and so on...

Okay, I've started working on the upgrade to jQuery 1.9/2.0.

One thing I have to say.
.on()/.off() is utter bollocks.

Because .unbind('click') shares a 'bind('click')' with .bind('click'), it compresses very well. While .on and .off don't share the same 'suffix'.
That means the actual compression rate is not as good as I thought it would be. Maybe it would help if I turned all .click() calls to .on('click'), but I did try that in the 1.5 days and it was disappointed and I reverted it.

Considering that .bind and .unbind are not deprecated (probably because they're used so much... So what's the point eh?), I could keep using them. But, fact is, I *do* save a couple of bytes per gzipped file when using .on(). The real only drawback is that we lose compatibility with 1.6 and below.

So, do you think we should keep .bind or drop it..?
Title: Re: jQuery support
Post by: live627 on February 1st, 2013, 10:08 AM
Why did they even introduce .on? What's wrong with .bind? I sincerely don't get it. It sounds stupid. You flick an electrical switch on and off, not a function! Bind/unbind make so much sense to me. I guess you can turn on an event, but you bind the function to the event. As in attach it.
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 10:29 AM
Quote from live627 on February 1st, 2013, 10:08 AM
Why did they even introduce .on? What's wrong with .bind? I sincerely don't get it. It sounds stupid.
http://blog.jquery.com/2011/09/28/jquery-1-7-beta-1-released/
They said it was to address an issue where unbinding an element would unbind another one. Which is due to the way they do delegate/live, but... What you gonna do eh?
The only point of these new functions, for me, is that they're shorter, and thus compress better. But because they didn't remove .bind/.unbind, jQuery itself is still larger than needed. To add insult to injury, they removed .live and .delegate, making it impossible to have code that's 100% compatible between 1.5.2 and 2.0... Pfft. I rewrote the .live in editor-func to a simpler .one() (it was begging for it, dunno why I forgot about that method!), but unfortunately I can't do anything about the .ip_button/.remove_button live events: it's got to be in one of the two formats... (Unless, of course, I rewrite the code to selectively spit out a .live or .on depending on the current jQuery version. Which sounds silly, because Wedge only supports one version at a time...)
Quote from live627 on February 1st, 2013, 10:08 AM
You flick an electrical switch on and off, not a function! Bind/unbind make so much sense to me. I guess you can turn on an event, but you bind the function to the event. As in attach it.
Yes, and .on() implies that you can only attach one event to the object.
Of course, they'll say that .on('click') is a reference to .onclick, but then what's .off('click') a reference to..?
Title: Re: jQuery support
Post by: Arantor on February 1st, 2013, 03:16 PM
*scowls at jQuery*
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 03:41 PM
Correction, they didn't remove .delegate! Then only removed .live and .die, possibly to force users to update their code. Granted, .live is not as efficient as .delegate, but why not delete ALL at least from v2.0 so they could save more bytes...? I don't see the point.

Anyway.

My biggest problem right now is with .attr() vs .prop()... I was under the impression that jQuery had, from v1.6.1, turned back and decided to let people do as they wish. Apparently, their Migrate plugin indicates that they're back to the "use .prop if it's a property" thing...
Heck, if they could only provide a complete guide with what exactly needs to be converted. I don't see any. I have to GUESS. jQuery is there for SAVING time, not WASTING it... -_-
I even waste a dozen minutes earlier today when I saw they'd removed support for $().error(), and I thought $.post().error() (which we use in topic.js or post.js, something) was in the lot. It wasn't. I posted on their blog to complain that they should update their documentation about that.

My...
Give me another week like that, and I'll definitely write my own 10KB jQuery equivalent.
Title: Re: jQuery support
Post by: Arantor on February 1st, 2013, 04:11 PM
The only thing I liked about .prop() for replacing .attr() was slightly saner handling of the checked attribute, as in you had to .attr('checked', 'checked') and .removeAttr('checked') to change it, but with .prop() it's simpler and could be done inline with a ternary expression.

Other than that it seemed like a change almost for the sake of change.
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 04:14 PM
Quote from Arantor on February 1st, 2013, 04:11 PM
The only thing I liked about .prop() for replacing .attr() was slightly saner handling of the checked attribute, as in you had to .attr('checked', 'checked') and .removeAttr('checked') to change it, but with .prop() it's simpler and could be done inline with a ternary expression.
Sure. But just for that one..? Not worth it.
Quote
Other than that it seemed like a change almost for the sake of change.
Which we don't want, either.

I'm starting to wonder whether it isn't too early to switch to jQuery 1.9+2.0... I mean, I'm only thinking of the 'release date', it'll be okay in that fashion, but what was the reason for the switch, already...? Saving 300-400 bytes in v2.0 for non-IE browsers..? Only that? Or something else? lol...

I would have better used my time today had I instead worked on thinking of the mini-skeleton implementation... :^^;:
Title: Re: jQuery support
Post by: Arantor on February 1st, 2013, 04:34 PM
Quote
Sure. But just for that one..? Not worth it.
Of course it wasn't worth it just for that. But I can see the logic of a single unified beast for it.

The thing about it is that there's an awful lot of legacy stuff to keep in mind too.
Quote
I'm starting to wonder whether it isn't too early to switch to jQuery 1.9+2.0... I mean, I'm only thinking of the 'release date', it'll be okay in that fashion, but what was the reason for the switch, already...? Saving 300-400 bytes in v2.0 for non-IE browsers..? Only that? Or something else? lol...
I don't know... I'm fairly happy with what we have... *shrug*
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 04:43 PM
Quote from Arantor on February 1st, 2013, 04:34 PM
Of course it wasn't worth it just for that. But I can see the logic of a single unified beast for it.
It's unified to a limit... Doing the big jump is the hardest one, after that it should be fairly easy to upgrade jQuery along with the main one, but then again we have two codebases to keep up with -- one for oldIE, one for HTML5 browsers.
Quote
The thing about it is that there's an awful lot of legacy stuff to keep in mind too.
Like..?
Quote
I don't know... I'm fairly happy with what we have... *shrug*
v1.4: the shortest one... Has all the features we need.
v1.5: a bit bigger, not even sure it fixes anything. Just adds an Ajax rewrite that doesn't really change a thing, except for the callbacks.
v1.6: big pile of crap, followed by a 'mehh..' 1.6.1
v1.7: meh.
v1.8: meh.
v1.9: meh!
v2.0: no IE support, yay!

So, in order to be able to benefit from v2.0 (shorter + likely to have less bugs...???), we have to go through a larger version for oldIE, as well as potentially more bytes in our code because of the .prop() changes. (Oh, you know me -- I'll optimize the code here and there to at least compensate for the loss...)

To me, it makes sense to go back to 1.4, as much as it makes sense to stay at 1.5 or go for 1.9/2.0.
The main consideration should be plugin authors. What do you want? The latest & meanest? Or the old ones that may be more compatible with whatever plugin you want to use?

(It's interesting to note that the jQuery plugin server 'broke' for so long... It's as if they wanted people NOT to download old outdated plugins. It's a conspiracy :P)
Title: Re: jQuery support
Post by: Arantor on February 1st, 2013, 04:45 PM
The main consideration is plugin authors. People are going to want to shove any old jQ plugin they find off the net into it expecting the most recent version. But jQuery itself has to be relatively mindful of its own legacy precisely because there's so much stuff out there built on top of it, so that major changes can't be done in a single version.

You say 1.4 has the features we need, but does it work with jQuery UI as bundled? Does that need rewriting/fetching an older version?
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 05:23 PM
I think jQuery 1.4 works with the latest 'legacy' jQuery UI, same as with v1.5...

http://w3techs.com/technologies/details/js-jquery/all/all

This page has interesting statistics for per-version usage.
As I thought, v1.4 is the most widely used 'legacy' version, i.e. that's when jQuery stabilized, having acquired all of its important features and fixed all of its major shortcomings. It went downhill after that, until the jQuery team made the (right) decision to focus on stripping code out of their codebase for v2.

But I was pretty sure v1.5 was more widely used than that. It isn't... However, even v1.4 is not that widely spread. It has a market share of about 20%, meaning that about 10% of all major websites use that version, and you have a relatively good chance of having it in your cache -- but it's not as good a chance as simply going for the most widely available version. As of now, it looks like it's v1.7, but I have good hopes that once we release Wedge to the public, v2.0 will be the most widely used one. (Or maybe v1.9...? That would not be as nice.)
Title: Re: jQuery support
Post by: MultiformeIngegno on February 1st, 2013, 06:01 PM
I'd say go with 2.0. You'll have to do the switch sooner or later. Because of plugin authors and the thousands of topics that will be open by people complaining Wedge to not have the latest jQuery. We choose not to adopt "Class A/B" browsers because of complaining users, an old jQuery version would be another complain indeed.. :P
Title: Re: jQuery support
Post by: Nao on February 1st, 2013, 07:32 PM
Alrighty.

I'm just annoyed by the .prop() thing right now... Everything else should be converted (I think), but .prop... It needs some looking into. I guess.
Title: Re: jQuery support
Post by: Nao on February 2nd, 2013, 09:43 PM
Still annoyed with .prop().
jQuery basically says, "you can keep using .attr, but you'll have to use .prop on a few things."
They never actually explain what the exact difference is.
Another blog says "you should convert EVERYTHING to .prop, it'll always work. Just work .attr if you need the original state of checkboxes and things like that."

I have yet to try the second solution, but it's quite tempting...

From what I could read online, there's an easy way to see the difference between attr and prop: take an anchor link where href="file.html". If you ask for .attr("href"), it'll return "file.html", while .prop("href" returns the entire path (including domain). In fact, .attr() is the equivalent of doing $('something')[0].getAttribute('attr'), while .prop is the equivalent of doing $('something')[0].prop -- now, that makes more sense to me! This is never actually explained in the jQuery documentations...
So, it does mean I should be able to convert .prop('src') and all things like that. But I don't know about, for instance, accessing XML tree attributes... Hopefully .prop() works. If I just need to rename all .attr to .prop, it'll just be easier for me. (And subsequent plugin authors.)
Title: Re: jQuery support
Post by: Arantor on February 2nd, 2013, 10:31 PM
jQuery's documentation has always been a bit sub-par, I thought. Using .prop consistently, if it's an option, would likely be easier.
Title: Re: jQuery support
Post by: Nao on February 3rd, 2013, 10:53 AM
I'm astounded...

1/ There's an old jQuery blog post that mentions 'in passing' a list of properties that should be used by .prop(), and it's not "everything should use prop more or less", it's just the *boolean* properties that should go through .prop()...

2/ Even worse. I was completely misled both by the migration guide(http://jquery.com/upgrade-guide/1.9/#attr-versus-prop-) (read that particular paragraph!), and by the jQuery Migrate plugin's source code. While it does indicate that using .attr() for these shouldn't be done, it does NOT mean that the .attr() compatibility code was removed from jQuery 1.9/2.0, EVEN though the plugin proceeds to implement such compatibility... This is where I got screwed. Look for 'rboolean' in both jQuery 1.9 and jQuery Migrate plugin. They're both defined, and tested again. That's madness. I'm disgusted -- wasted a day trying to find proper documentation when all in all, it was still in it.

I sincerely hope that they never frigging enforce the .prop() behavior. If they do, I'll just resort to using it ONLY for boolean properties (the only difference is that a gzipped script.js+sbox.js will take an additional 3 bytes, as only .attr('readOnly', true) is concerned here.)
I will not waste another minute of my time trying to figure out what to do, what to change.

They still have a long list of things that should be checked against re: the upgrade guide... I'm very tempted to call it quits and just go with it.
I know I'll finish it, but I'm still pissed.
Posted: February 3rd, 2013, 10:03 AM
Quote from Nao on February 3rd, 2013, 10:03 AM
I sincerely hope that they never frigging enforce the .prop() behavior. If they do, I'll just resort to using it ONLY for boolean properties (the only difference is that a gzipped script.js+sbox.js will take an additional 3 bytes, as only .attr('readOnly', true) is concerned here.)
There are also two .attr('selected', true) lines in sbox.js, but I don't know if it'd change the byte count.
Not that it matters... As I said, it works right now, and I don't want to even think of separating the two functions.
jQuery's one and ONLY goal is to give developers helper functions to make their life easier. I don't *care* if it makes life hell for the jQuery team. It's not that I don't like them -- it's that they should be happy they're used on half the largest sites of the world. It means what they've been doing is USEFUL. It means they're making JavaScript FUN to use. It means they're making their life hell so that ours isn't. It's a sacrifice for the greater good. So I don't care that I should use .prop() instead of .attr(). So, .attr() is four times slower than .prop() when used on properties? Big deal. If my .attr() calls were time-sensitive, I wouldn't call object.attr(property) or .prop() at all -- I'd call the property directly on the DOM object, that's all.
It's not that I think they should revert their behavior, since that's what they did in 1.6.1... It's that I think they should stop telling people that using .attr() is bad. YES, we KNOW it's bad. Just like using jQuery is BAD on time-sensitive loops, but you'll never see them mention that, will you...? Nothing is bad per se. What is bad is what bothers you. What bothers me is a wasted byte in a gzipped file. That's why I switched Wedge to use jQuery 2.0 -- because it's smaller than v1.5 overall, not for the extra features or bug fixes.

Ahh... Feels good to talk about it.
Posted: February 3rd, 2013, 10:34 AM

I knew there was a Google result that made me jump to my guns and start looking into the migration plugin code! :lol:
https://github.com/bcardarella/client_side_validations/pull/466

So, I guess it was an 'unfortunate series of events' that led me to believe they'd dropped .attr() support for properties...
Title: Re: jQuery support
Post by: MultiformeIngegno on February 3rd, 2013, 02:20 PM
à propos, I use this(http://code.google.com/p/galleriffic/source/browse/trunk/example/js/jquery.galleriffic.js) plugin, Galleriffic. I run the jQuery Migrate Plugin and I noticed that it uses .attr too (if you do a search you can find 12 references),
Should I change those to .prop or can I leave them there? :)
Title: Re: jQuery support
Post by: Nao on February 3rd, 2013, 11:59 PM
Basically: keep it as it is.

What they're not telling us, or telling us in a convoluted manner, is that:

- you can use .attr() on anything (attributes and properties), jQuery will do the cleaning up,
- you should use .prop() on properties, and you REALLY should use it on properties that accept/return a boolean value (there's a list hidden in the migrate plugin, includes checked, disabled, autoplay, readOnly, etc...)....
- ...BUT you don't HAVE to use .prop() anywhere, it's just a matter of semantics really, and .prop() is also 4 times faster,
- and basically, if you want speed, you should directly access the DOM property, rather than use a jQuery method.

So, in the end: jQuery 1.9 didn't require ANY changes in Wedge, except for the .live() function being removed, and I used it a total of 3 times. The rest is just either semantics on their side, or changes that allow me to save a few extra bytes so I'm adopting them. But even then, it would be easy to come back to a v1.5 implementation.
Title: Re: jQuery support
Post by: Nao on February 4th, 2013, 05:16 PM
I'm not exactly thrilled with jQuery 1.9, really... -_-

After the .prop() fiasco of today (see thoughts page for this), a new bug has emerged. If you edit a thought that has HTML in it, it gives you an empty text input.

The reason: HTML strings trigger a request to the server to get an HTML-free version. This is sent through Ajax (because we're worthy), and returned via a <?xml> page, processed with responseXML, and shown in the text input.
However, for an unknown reason, even when trying to force the 'xml' dataType, jQuery INSISTS on returning a plain text string instead of an XML object... i.e. the result is in responseText, not responseXML.

It can "easily be fixed" by replacing responseXML with responseText, but... WHY? Oh, WHY???!!!

Why the hell is jQuery full of bugs now? There were a few bugs in v1.5 but they were nothing to be angry about! This one is!
Are we gonna find bugs forever like this? Or will they fix them in v1.9.1 and we just have to be patient..?!
Title: Re: jQuery support
Post by: Nao on February 4th, 2013, 11:13 PM
So... This is a totally undocumented bug. I don't know if I should care to 'report' it. I've read a bug report from v1.8 saying that the jQuery team has deprecated { async: false } in $.ajax, just because they didn't like that, basically... Apparently to them, it's important that 'A'jax is always 'A'synchronous, so synchronous calls should be done from a function called $.sjax... Lol. Well, anyway, the stuff is still there, and usable and all, but it simply doesn't return a proper responseXML. Only a responseText. So I thought about it and looked into the Wedge codebase, this is the only place where I'm doing a synchronous call, and turning it into an asynchronous call would be disastrous. So, you know what I did...?

I just rewrote Ajax.php to return a simple text string. Voilà. And it makes script.js a bit shorter, too... It's not as clean as before, but anyway we already discussed returning JSON instead of XML for all calls, haven't worked on that because it's a lot of work for a result that may not be that rewarding, but at least in that particular case, getting rid of XML felt good... ;)
Title: Re: jQuery support
Post by: Arantor on February 4th, 2013, 11:27 PM
Quote from Nao on February 4th, 2013, 11:13 PM
So... This is a totally undocumented bug. I don't know if I should care to 'report' it. I've read a bug report from v1.8 saying that the jQuery team has deprecated { async: false } in $.ajax, just because they didn't like that, basically... Apparently to them, it's important that 'A'jax is always 'A'synchronous, so synchronous calls should be done from a function called $.sjax... Lol. Well, anyway, the stuff is still there, and usable and all, but it simply doesn't return a proper responseXML. Only a responseText. So I thought about it and looked into the Wedge codebase, this is the only place where I'm doing a synchronous call, and turning it into an asynchronous call would be disastrous. So, you know what I did...?
Wait, what? Am I seriously reading this correctly?
Quote from Nao on February 4th, 2013, 11:13 PM
I just rewrote Ajax.php to return a simple text string. Voilà. And it makes script.js a bit shorter, too... It's not as clean as before, but anyway we already discussed returning JSON instead of XML for all calls, haven't worked on that because it's a lot of work for a result that may not be that rewarding, but at least in that particular case, getting rid of XML felt good... ;)
That makes a lot of sense :) Actually there aren't many places we do export XML, it's more internal use. I did contemplate - briefly, mind - using JSON for the plugin manager but the one thing XML does that JSON doesn't cleanly do is be able to attach attributes to elements in a multidimensional fashion, e.g. <element attr="value"> without making it another level of nesting.
Posted: February 4th, 2013, 11:25 PM

Also, you're not the Wesley Crusher of gzipping, you're the Data of gzipping. Being the Wesley Crusher makes you the smart-arse no-one likes (and one person even told him to his face that it's a good thing he's cute otherwise he could be obnoxious), whereas being the Data of gzipping means it's cool to be intense about it.
Title: Re: jQuery support
Post by: Nao on February 5th, 2013, 12:58 PM
Quote from Arantor on February 4th, 2013, 11:27 PM
Quote from Nao on February 4th, 2013, 11:13 PM
So... This is a totally undocumented bug. I don't know if I should care to 'report' it. I've read a bug report from v1.8 saying that the jQuery team has deprecated { async: false } in $.ajax, just because they didn't like that, basically... Apparently to them, it's important that 'A'jax is always 'A'synchronous, so synchronous calls should be done from a function called $.sjax... Lol. Well, anyway, the stuff is still there, and usable and all, but it simply doesn't return a proper responseXML. Only a responseText. So I thought about it and looked into the Wedge codebase, this is the only place where I'm doing a synchronous call, and turning it into an asynchronous call would be disastrous. So, you know what I did...?
Wait, what? Am I seriously reading this correctly?
What? The sjax story? Yes you do...

As for the bug, I decided to report it to the team, because Wedge is one thing, but the entire interwebs (or at least 55% of them) are another.

http://bugs.jquery.com/ticket/13388
Quote
That makes a lot of sense :) Actually there aren't many places we do export XML, it's more internal use. I did contemplate - briefly, mind - using JSON for the plugin manager but the one thing XML does that JSON doesn't cleanly do is be able to attach attributes to elements in a multidimensional fashion, e.g. <element attr="value"> without making it another level of nesting.
Yeah, its main advantage is readability, and this is certainly why we should keep XML to an extent, for instance in plugin(?:-info)?.xml and (?:skin|skeleton-.*?).xml. But for Ajax communication, it would be best to use JSON or text strings. For instance -- in thought XML, we could very simply return the resulting array as a JSON object, it doesn't really need more processing. (Or if need be, can be done earlier in the code than at xml templating time.)

I don't think this is a feature change that would hurt plugins or themes if we postponed it to after the gold release, so it's not urgent whatsoever, but it'd be nice.
Quote
Also, you're not the Wesley Crusher of gzipping, you're the Data of gzipping. Being the Wesley Crusher makes you the smart-arse no-one likes (and one person even told him to his face that it's a good thing he's cute otherwise he could be obnoxious), whereas being the Data of gzipping means it's cool to be intense about it.
It's not about what I WANT to be, it's about being realistic... And in life, I basically behave like an annoying little Wesley Crusher. Especially when you gather a lot of people into a room and someone has the audacity of pronouncing the name of a movie or TV show I recently enjoyed. Then you can't stop me... It becomes all about name dropping. Last Sunday I think I annoyed quite a few people. More Crusher points for me.
Title: Re: jQuery support
Post by: Arantor on February 5th, 2013, 04:43 PM
They appear to have agreed with you about the bug. :)
Title: Re: jQuery support
Post by: Nao on February 6th, 2013, 05:52 PM
Yeah, and even more amusing, there are more people asking that jQuery fixes it NAO!!!!11
These people probably wouldn't have noticed the bug without my report, though... ;)

But I understand how it is to read something and to immediately be upset because you realize you're concerned and you didn't catch it in the first place.

I'm thinking that the reason for the bug in the first place is that v2.0 was simplified by removing all IE hacks, but this particular one was marked as an IE hack when really it was a generic hack.