]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
parseValue() full match with string literals
authormaks feltrin <pine3ree@gmail.com>
Fri, 21 Oct 2016 20:34:54 +0000 (22:34 +0200)
committerGitHub <noreply@github.com>
Fri, 21 Oct 2016 20:34:54 +0000 (22:34 +0200)
the original regex matching would have made values like "untrue" to be interpreted as `true` and values like "not-false" as `false`
see https://github.com/zurb/foundation-sites/pull/9149

js/foundation.core.js

index c3430a1dcd6c04bfec76bacfb4498f1e898bcd1e..50228e2f888d335e4c093c8102744b7365562bd7 100644 (file)
@@ -364,8 +364,8 @@ function functionName(fn) {
   }
 }
 function parseValue(str){
-  if(/true/.test(str)) return true;
-  else if(/false/.test(str)) return false;
+  if('true' === str) return true;
+  else if('false' === str) return false;
   else if(!isNaN(str * 1)) return parseFloat(str);
   return str;
 }