Unnecessary and missing semicolon. #327

Merged
merged 4 commits into from Mar 19, 2012

Projects

None yet

2 participants

@fredj
Member
fredj commented Mar 16, 2012
@tschaub tschaub commented on an outdated diff Mar 16, 2012
lib/OpenLayers/Request.js
@@ -79,7 +79,7 @@ OpenLayers.Request = {
* will be the same as the provided url.
*/
makeSameOrigin: function(url, proxy) {
- var sameOrigin = !(url.indexOf("http") == 0);
+ var sameOrigin = !OpenLayers.String.startsWith(url, "http");
var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);
@tschaub
tschaub Mar 16, 2012 OpenLayers member

Is there reason to use (or even have) the OpenLayers.String.startsWith method?

If it is a confusing use of !, I would think url.indexOf("http") !== 0 would suffice here. If we don't care about confusion, I'd even go with !~url.indexOf("http").

@tschaub
Member
tschaub commented Mar 16, 2012

With or without considering the above comment, I think this is good. Please merge.

@fredj fredj merged commit c637460 into openlayers:2.12 Mar 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment