From 08b881578bac0bed281e2a9da8f55ddae6155863 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 10 Jan 2014 11:16:39 -0500 Subject: [PATCH] fix(dom) selectByPattern: "." -> "\." --- lib/client/dom.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 06c78402..9da9dbb2 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1179,7 +1179,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; function selectByPattern(msg, files) { var allMsg = 'Specify file type for ' + msg + ' selection', i = 0, - n, + n = files && files.length, arr = [], type, matches = 0, @@ -1198,23 +1198,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; type = '*'; type = '^' + type; /* search from start of line */ - type = Util.replaceStr(type, '*', '.*\\'); + type = Util.replaceStr(type, '.', '\\.'); + type = Util.replaceStr(type, '*', '.*'); type = Util.replaceStr(type, '?', '.?\\'); - - arr = type && type.split(''); - n = arr.length; - - /* back slash at end of line - * do not need - */ - if (arr[n - 1] === '\\') { - arr.pop(); - type = arr.join(''); - } - type += '$'; /* search to end of line */ - n = files && files.length; do { if (shouldSel) current = files[i++];