Leaflet/Leaflet — pull request #1607 by kristerkari (2013-04-19 23:39:56+00:00)
Title: Fix regexes that break Leaflet inside a multi line comment block, fixes #1288

This is a fix for issue #1288.

Currently the `*/` characters inside Leaflet's regular expressions break multi line comment blocks that can be used for lazy evaluating javascript [[source 1]](http://calendar.perfplanet.com/2011/lazy-evaluation-of-commonjs-modules/) [[source 2]](https://gist.github.com/4113133).

In addition to working around the regular expressions, I have also added `L.Util.trim` which with these changes is used by `L.Util.splitWords` and `L.DomUtil.removeClass`. If adding `trim` method is a problem, I can provide an alternative workaround.

`trim` and `removeClass` methods are the same ones used in Pikaday.js:
https://github.com/dbushell/Pikaday/blob/master/pikaday.js#L73

**List of changes:**

1. Added `L.Util.trim` method.
2. Changed `L.Util.splitWords` to call `L.Util.trim`.
3. Replaced `L.DomUtil.removeClass` with a new one to avoid having a regular expression with `*/`. Also uses `L.Util.trim`.
4. Added parentheses around the regular expression in `Path.VML.js` to avoid having a regular expression with `*/`.

**Linting and tests:**

````
Checking for JS errors...
Check passed
................................................................................
................................................................................
....................................
PhantomJS 1.9 (Mac): Executed 196 of 196 SUCCESS (1.393 secs / 0.727 secs)
```

Let me know if any changes are needed.