Skip to content

Commit

Permalink
Eliminate no-longer-needed Chrome/IE bug fix (knockout#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Feb 24, 2012
1 parent 7de57bf commit 7845ad5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/binding/defaultBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@ ko.bindingHandlers['options'] = {
return ko.selectExtensions.readValue(node) || node.innerText || node.textContent;
});
var previousScrollTop = element.scrollTop;

// Workaround for a Chrome rendering bug. Note that we restore the scroll position later.
// https://github.com/SteveSanderson/knockout/issues/215 (Chrome bug)
// https://github.com/SteveSanderson/knockout/issues/273 (IE issue with fix for Chrome bug)
if (ko.utils.isChrome)
element.scrollTop = 0;

var value = ko.utils.unwrapObservable(valueAccessor());
var selectedValue = element.value;
Expand Down Expand Up @@ -259,7 +253,8 @@ ko.bindingHandlers['options'] = {
}
}

element.scrollTop = previousScrollTop;
if (previousScrollTop)
element.scrollTop = previousScrollTop;

if (selectWasPreviouslyEmpty && ('value' in allBindings)) {
// Ensure consistency between model value and selected option.
Expand Down
4 changes: 0 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ ko.utils = new (function () {
var isIe6 = ieVersion === 6,
isIe7 = ieVersion === 7;

var isChrome = /chrome/i.test(window.navigator.userAgent);

function isClickOnCheckableElement(element, eventType) {
if ((element.tagName != "INPUT") || !element.type) return false;
if (eventType.toLowerCase() != "click") return false;
Expand Down Expand Up @@ -335,8 +333,6 @@ ko.utils = new (function () {
isIe7 : isIe7,
ieVersion : ieVersion,

isChrome : isChrome,

getFormFields: function(form, fieldName) {
var fields = ko.utils.makeArray(form.getElementsByTagName("INPUT")).concat(ko.utils.makeArray(form.getElementsByTagName("TEXTAREA")));
var isMatchingField = (typeof fieldName == 'string')
Expand Down

0 comments on commit 7845ad5

Please sign in to comment.