From be769c089a2f43560df90481c39e455aea197a0e Mon Sep 17 00:00:00 2001 From: clyates Date: Tue, 18 Mar 2014 23:18:28 +0000 Subject: [PATCH] Update foundation.interchange.js 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 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/foundation/foundation.interchange.js b/js/foundation/foundation.interchange.js index 0fa88c2cf..623904515 100644 --- a/js/foundation/foundation.interchange.js +++ b/js/foundation/foundation.interchange.js @@ -58,13 +58,10 @@ 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) { -- 2.47.2