Permalink
Browse files

Removed dependency on `Array.indexOf(...)`.

  • Loading branch information...
1 parent 80b9c60 commit 7b019d9148715c206c00dfc02bc70dcdc0d35d19 @knpwrs knpwrs committed Apr 12, 2012
Showing with 3 additions and 9 deletions.
  1. +3 −9 filters/yepnope.pathfilter.js
@@ -10,10 +10,6 @@
* load: ['google/jquery/1.7.2/jquery.min.js', 'google/jqueryui/1.8.18/jquery-ui.min.js', 'my-cdn/style.css', '/non/path/directory/file.js']
* });
*
- * Requirements:
- * The browser must implement Array.indexOf(...). If you have to support browsers which don't implement this method please make sure you define it.
- * See: http://soledadpenades.com/2007/05/17/arrayindexof-in-internet-explorer/
- *
* Official Yepnope Plugin
*
* WTFPL License
@@ -26,12 +22,10 @@
yn.addFilter(function (resource) {
// check each url for path
for (path in yn.paths) {
- if (resource.url.indexOf(path) === 0) {
- resource.url = resource.url.replace(path, yn.paths[path]);
- return resource;
- }
+ resource.url = resource.url.replace(new RegExp('^' + path), yn.paths[path]);
+ return resource;
}
- //carry on my wayward, son
+ // carry on my wayward, son
return resource;
});
};

0 comments on commit 7b019d9

Please sign in to comment.