Permalink
Browse files

Fix for issue #48

  • Loading branch information...
1 parent a4cb784 commit e2b5cc604462a701cb10da13c41cbed5d215f1b5 @victor-homyakov victor-homyakov committed Dec 13, 2011
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/dommonster.js
View
@@ -277,21 +277,20 @@
JR.tip('<span style="cursor:help" title="'+sources.join('\n')+'">Found '+headcount+' &lt;script&gt; tags in HEAD.</span>','For better perceived loading performance move script tags to end of document; or use a non-blocking JS loader library.');
};
+ function digitCompare(user, edge) {
+ return (~~user || 0) >= (edge || 0);
+ }
+
JR.versionCompare = function(userVersion, edgeVersion) {
if(userVersion === undefined) return true;
userVersion = userVersion.split('.');
- var major = ~~userVersion[0] >= edgeVersion[0],
- minor = userVersion[1] ? (~~userVersion[1] >= edgeVersion[1]) : true,
- build = userVersion[2] ? (~~userVersion[2] >= edgeVersion[2]) : true;
-
- if(!major || major && !minor || major && minor && !build) {
- return false;
- }
-
- return true;
+ var major = digitCompare(userVersion[0], edgeVersion[0]),
+ minor = digitCompare(userVersion[1], edgeVersion[1]),
+ build = digitCompare(userVersion[2], edgeVersion[2]);
+ return (!major || major && !minor || major && minor && !build);
};
JR.frameworkTips = function(){

0 comments on commit e2b5cc6

Please sign in to comment.