]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Update foundation.interchange.js 4724/head
authorclyates <chris@clyates.plus.com>
Tue, 18 Mar 2014 23:18:28 +0000 (23:18 +0000)
committerclyates <chris@clyates.plus.com>
Tue, 18 Mar 2014 23:18:28 +0000 (23:18 +0000)
Use regex literal to remove need for regex var
New regex tests for an image extension at the end of path

js/foundation/foundation.interchange.js

index 0fa88c2cf70c3a99578c8477d96b7ce9acf62571..6239045150d0f2a48fb8438b5010958a8bed29f4 100644 (file)
           if (last_path == path) return;
 
 
-          var regex = "/(\.jpg|\.jpeg|\.png|\.gif|\.tiff|\.bmp)$/";
-
-          if (new RegExp(regex,'i').test(path)){
-
-              $(el).css('background-image', 'url('+path+')');
-              el.data('interchange-last-path', path);
-              return trigger(path);
+          if (/\.(jpg|jpeg|png|gif|tiff|bmp)$/i.test(path)) {
+            $(el).css('background-image', 'url('+path+')');
+            el.data('interchange-last-path', path);
+            return trigger(path);
           }
 
           return $.get(path, function (response) {