Last active
May 24, 2016 22:02
-
-
Save paton/019be9913a7b3aa70dbde98459563829 to your computer and use it in GitHub Desktop.
window.document.normalize() breaks Knockout 3.3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script> | |
<script> | |
// Problem occurs on IE 11 on Windows 10 (and earlier versions) | |
// Problem does NOT occur in Chrome | |
// window.document.normalize(); breaks knockoutjs bindings | |
// Upgrading to Knockout 3.4.0 fixes the problem | |
$(function () { | |
var view = { | |
list: ko.observableArray([{ item: 'Dog' }, { item: 'Cat' }]) | |
}; | |
ko.applyBindings(view, document.getElementById('list')); | |
window.document.normalize(); // This line breaks the knockout bindings | |
setTimeout(function() { | |
view.list([]); | |
view.list.push({ item: 'Person' }); | |
// Should: update table with just "Person" | |
// Observed: Table updates to "Person" and "Dog", but "Cat" is removed | |
}, 1000); | |
}); | |
</script> | |
</head> | |
<body> | |
<div data-bind="foreach: list" id="list"> | |
<div data-bind="text: item"></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment