|
1 | 1 | /*! |
2 | 2 | * URI.js - Mutating URLs |
3 | 3 | * |
4 | | - * Version: 1.11.1 |
| 4 | + * Version: 1.11.2 |
5 | 5 | * |
6 | 6 | * Author: Rodney Rehm |
7 | 7 | * Web: http://medialize.github.com/URI.js/ |
|
27 | 27 | "use strict"; |
28 | 28 |
|
29 | 29 | // save current URI variable, if any |
30 | | -var _URI = root.URI; |
| 30 | +var _URI = root && root.URI; |
31 | 31 |
|
32 | 32 | function URI(url, base) { |
33 | 33 | // Allow instantiation without the 'new' keyword |
@@ -451,8 +451,10 @@ URI.parseAuthority = function(string, parts) { |
451 | 451 | }; |
452 | 452 | URI.parseUserinfo = function(string, parts) { |
453 | 453 | // extract username:password |
454 | | - var pos = string.indexOf('@'); |
455 | 454 | var firstSlash = string.indexOf('/'); |
| 455 | + var pos = firstSlash > -1 |
| 456 | + ? string.lastIndexOf('@', firstSlash) |
| 457 | + : string.indexOf('@'); |
456 | 458 | var t; |
457 | 459 |
|
458 | 460 | // authority@ must come before /path |
@@ -781,30 +783,29 @@ URI.ensureValidHostname = function(v) { |
781 | 783 |
|
782 | 784 | // noConflict |
783 | 785 | URI.noConflict = function(removeAll) { |
784 | | - if(removeAll){ |
785 | | - var unconflicted = { |
786 | | - URI: this.noConflict() |
787 | | - }; |
| 786 | + if (removeAll) { |
| 787 | + var unconflicted = { |
| 788 | + URI: this.noConflict() |
| 789 | + }; |
788 | 790 |
|
789 | | - if(URITemplate && typeof URITemplate.noConflict == "function") { |
790 | | - unconflicted.URITemplate = URITemplate.noConflict(); |
791 | | - } |
792 | | - if(IPv6 && typeof IPv6.noConflict == "function") { |
793 | | - unconflicted.IPv6 = IPv6.noConflict(); |
794 | | - } |
795 | | - if(SecondLevelDomains && typeof SecondLevelDomains.noConflict == "function") { |
796 | | - unconflicted.SecondLevelDomains = SecondLevelDomains.noConflict(); |
797 | | - } |
| 791 | + if (URITemplate && typeof URITemplate.noConflict == "function") { |
| 792 | + unconflicted.URITemplate = URITemplate.noConflict(); |
| 793 | + } |
| 794 | + |
| 795 | + if (IPv6 && typeof IPv6.noConflict == "function") { |
| 796 | + unconflicted.IPv6 = IPv6.noConflict(); |
| 797 | + } |
| 798 | + |
| 799 | + if (SecondLevelDomains && typeof SecondLevelDomains.noConflict == "function") { |
| 800 | + unconflicted.SecondLevelDomains = SecondLevelDomains.noConflict(); |
| 801 | + } |
798 | 802 |
|
799 | | - return unconflicted; |
800 | | - } |
801 | | - else { |
802 | | - if (root.URI === this) { |
803 | | - root.URI = _URI; |
| 803 | + return unconflicted; |
| 804 | + } else if (root.URI === this) { |
| 805 | + root.URI = _URI; |
804 | 806 | } |
805 | 807 |
|
806 | 808 | return this; |
807 | | - } |
808 | 809 | }; |
809 | 810 |
|
810 | 811 | p.build = function(deferBuild) { |
|
0 commit comments