Modify or replace regexes that break javascript lazy evaluation with multi line comments

This commit is contained in:
Krister Kari 2013-04-20 02:01:56 +03:00
parent 904bf581dd
commit dc07a68ed0
2 changed files with 2 additions and 10 deletions

View File

@ -130,15 +130,7 @@ L.DomUtil = {
}, },
removeClass: function (el, name) { removeClass: function (el, name) {
el.className = L.Util.trim((' ' + el.className + ' ').replace(' ' + name + ' ', ' '));
function replaceFn(w, match) {
if (match === name) { return ''; }
return w;
}
el.className = el.className
.replace(/(\S+)\s*/g, replaceFn)
.replace(/(^\s+|\s+$)/, '');
}, },
setOpacity: function (el, value) { setOpacity: function (el, value) {

View File

@ -78,7 +78,7 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
if (options.dashArray) { if (options.dashArray) {
stroke.dashStyle = options.dashArray instanceof Array ? stroke.dashStyle = options.dashArray instanceof Array ?
options.dashArray.join(' ') : options.dashArray.join(' ') :
options.dashArray.replace(/ *, */g, ' '); options.dashArray.replace(/( *, *)/g, ' ');
} else { } else {
stroke.dashStyle = ''; stroke.dashStyle = '';
} }