I copied one of examples of knockoutjs:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/2.2.0/knockout-min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<h2>Participants</h2>
Here are the participants:
<div data-bind="template: { name: 'person-template', data: buyer }"></div>
<div data-bind="template: { name: 'person-template', data: seller }"></div>
<script id="person-template" type="text/html">
<h3 data-bind="text: name"></h3>
<p>Credits: <span data-bind="text: credits"></span></p>
</script>
<script type="text/javascript">
function MyViewModel() {
this.buyer = { name: 'Franklin', credits: 250 };
this.seller = { name: 'Mario', credits: 5800 };
}
ko.applyBindings(new MyViewModel());
</script>
</html>
When I updated jQuery to Version 1.9, I'm got following error:
Uncaught TypeError: Object function (e,t){return new st.fn.init(e,t,X)} has no method 'clean'
I'd appreciate it if someone could explain if the bug is in jQuery or KO.
The Cause
You are not using the most current version of Knockout. The previous version, 2.2.0, is incompatible with jQuery 1.9.x and on. See this Knockout dev thread:
Knockout 2.2.0 uses jQuery.clean() which is deprecated and does not exist in 1.9.
This means that Knockout 2.2.0 is calling an undefined jQuery method, thus triggering the JS error you specified.
Solutions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With