Support for jQuery 1.9 #796

Merged
merged 1 commit into from Jan 15, 2013

Conversation

Projects
None yet
5 participants
Contributor

SteveSanderson commented Jan 14, 2013

Knockout 2.2.0 uses jQuery.clean() which is deprecated and does not exist in 1.9.

As suggested in the migration plugin page, you could use jQuery.parseHTML() insted of jQuery.clean() but I'm not sure of the consequences of this change.

The only line of code I can find in Knockout that uses jQuery.clean is as follows:

var elems = jQuery['clean']([html]); 
Contributor

SteveSanderson commented Jan 14, 2013

Great point, thanks for raising it!

I guess this is kind of urgent because we can't control when jQuery 1.9 is released, and as soon as it is, people will start telling us that KO is breaking. We should at least have an up-to-date build of KO that works with jQuery 1.9.

The attached pull request makes all the specs start passing with jQuery 1.9, and is very simple. If anyone is aware of any reason why the change from 'clean' to 'parseHTML' will have unwanted side-effects, please let us know!

Ready to merge if Michael/Ryan is happy with it.

Contributor

SteveSanderson commented Jan 14, 2013

Hmm, since #761 was merged, we don't have knockout-latest.js in the build/output directory any more. This makes it slightly more tricky to offer people an easy "latest dev version with jQuery 1.9 support" download.

Ideally there would be a way for Travis CI to somehow publish its most recent build from the master branch to a publicly downloadable location. Anyone got any suggestions on how we could do that?

The reason this matters is that people will need a way of continuing to use KO after they upgrade to jQuery 1.9 and before KO 2.3+ is released. Maybe we just release KO 2.2.1 with only the jQuery 1.9 patch and no other changes since 2.2.0. Thoughts?

Owner

mbest commented Jan 14, 2013

I'm fine with releasing a 2.2.1 version with just this change.

For publishing the latest build, I found this article about an upload feature supported by Travis CI: http://about.travis-ci.org/blog/2012-12-18-travis-artifacts/

Owner

mbest commented Jan 14, 2013

BTW, I think this will resolve #503 also.

Contributor

paglias commented Jan 15, 2013

jQuery 1.9 is out! http://jquery.com/

Contributor

SteveSanderson commented Jan 15, 2013

Knockout 2.2.1 is out! http://knockoutjs.com/downloads/ :)

It's identical to 2.2.0 except for adding jQuery 1.9.0 support.

Contributor

SteveSanderson commented Jan 15, 2013

Oops, reopening, as this hasn't been merged into master yet. Michael/Ryan, could you merge it?

rniemeyer added a commit that referenced this pull request Jan 15, 2013

@rniemeyer rniemeyer merged commit d756259 into master Jan 15, 2013

@mbest mbest deleted the 796-support-jquery-1-9 branch Apr 5, 2013

Actually, the support added for jquery 1.9 is incomplete it uses the jQuery.parseHTML function by passing it just the first argument, while keeping its third argument, keepScript, to its default that is false. This means any javascript in the template is removed prior to its execution. This behaviour differs from the behaviour for jquery <1.9 where scripts are kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment