Skip to content

Commit c8dfb23

Browse files
committed
Merge pull request victorjonsson#184 from stevewasiura/patch-8
findScriptPathAndLoadModules speed up path
2 parents 0cd6b32 + 95bf856 commit c8dfb23

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

form-validator/jquery.form-validator.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -762,16 +762,11 @@
762762
} else {
763763
var findScriptPathAndLoadModules = function() {
764764
var foundPath = false;
765-
$('script').each(function() {
766-
if( this.src ) {
767-
var scriptName = this.src.substr(this.src.lastIndexOf('/')+1, this.src.length);
768-
if(scriptName.indexOf('jquery.form-validator.js') > -1 || scriptName.indexOf('jquery.form-validator.min.js') > -1) {
769-
foundPath = this.src.substr(0, this.src.lastIndexOf('/')) + '/';
770-
if( foundPath == '/' )
771-
foundPath = '';
772-
return false;
773-
}
774-
}
765+
$('script[src*="form-validator"]').each(function() {
766+
foundPath = this.src.substr(0, this.src.lastIndexOf('/')) + '/';
767+
if( foundPath == '/' )
768+
foundPath = '';
769+
return false;
775770
});
776771

777772
if( foundPath !== false) {

0 commit comments

Comments
 (0)