Skip to content

Instantly share code, notes, and snippets.

@nickjacob
Created November 1, 2012 16:05
Show Gist options
  • Save nickjacob/3994600 to your computer and use it in GitHub Desktop.
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
/**
* 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