Skip to content

Commit

Permalink
Stylistic tweaks to previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Oct 24, 2011
1 parent 94098b4 commit c64e53b
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,20 @@ ko.utils = new (function () {
}
}

//use IE conditionals rather than the user agent to detect the version
//using code from here: https://gist.github.com/527683
var isIe6 = false;
var isIe7 = false;
var ie = (function(){

var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
// Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
var ieVersion = (function() {
var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');

// Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
);

return v > 4 ? v : undef;

div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',
iElems[0]
);
return version > 4 ? version : undefined;
}());

if(ie) {
isIe6 = ie === 6;
isIe7 = ie === 7;
}

var isIe6 = ieVersion === 6,
isIe7 = ieVersion === 7;

function isClickOnCheckableElement(element, eventType) {
if ((element.tagName != "INPUT") || !element.type) return false;
if (eventType.toLowerCase() != "click") return false;
Expand Down

0 comments on commit c64e53b

Please sign in to comment.