Created
November 1, 2012 16:05
-
-
Save nickjacob/3994600 to your computer and use it in GitHub Desktop.
url parsing "plugin" in response to this: https://github.com/websanova/js-url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* URL Parsing "Library"/function | |
* https://github.com/websanova/js-url <-- this is unnecessarily complex | |
*/ | |
;(function _url(window,undefined){ | |
function Url(url){ | |
this.elem = window.document.createElement('a'); | |
this.elem.href = url || window.location; | |
var self = this; | |
for(var part in this.elem){ | |
if(this.elem.hasOwnProperty(part)){ | |
(function(method){ | |
self[method] = self.elem[method]; | |
})(part); | |
} | |
} | |
} | |
window._Url = Url; | |
})(window); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment