diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/microformats/test/lib/url.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/microformats/test/lib/url.js')
-rw-r--r-- | toolkit/components/microformats/test/lib/url.js | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/toolkit/components/microformats/test/lib/url.js b/toolkit/components/microformats/test/lib/url.js deleted file mode 100644 index 81ed9f29e..000000000 --- a/toolkit/components/microformats/test/lib/url.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - url - Where possible use the modern window.URL API if its not available use the DOMParser method. - - Copyright (C) 2010 - 2015 Glenn Jones. All Rights Reserved. - MIT License: https://raw.github.com/glennjones/microformat-shiv/master/license.txt -*/ - -var Modules = (function (modules) { - - - modules.url = { - - - /** - * creates DOM objects needed to resolve URLs - */ - init: function(){ - //this._domParser = new DOMParser(); - this._domParser = modules.domUtils.getDOMParser(); - // do not use a head tag it does not work with IE9 - this._html = '<base id="base" href=""></base><a id="link" href=""></a>'; - this._nodes = this._domParser.parseFromString( this._html, 'text/html' ); - this._baseNode = modules.domUtils.getElementById(this._nodes,'base'); - this._linkNode = modules.domUtils.getElementById(this._nodes,'link'); - }, - - - /** - * resolves url to absolute version using baseUrl - * - * @param {String} url - * @param {String} baseUrl - * @return {String} - */ - resolve: function(url, baseUrl) { - // use modern URL web API where we can - if(modules.utils.isString(url) && modules.utils.isString(baseUrl) && url.indexOf('://') === -1){ - // this try catch is required as IE has an URL object but no constuctor support - // http://glennjones.net/articles/the-problem-with-window-url - try { - var resolved = new URL(url, baseUrl).toString(); - // deal with early Webkit not throwing an error - for Safari - if(resolved === '[object URL]'){ - resolved = URI.resolve(baseUrl, url); - } - return resolved; - }catch(e){ - // otherwise fallback to DOM - if(this._domParser === undefined){ - this.init(); - } - - // do not use setAttribute it does not work with IE9 - this._baseNode.href = baseUrl; - this._linkNode.href = url; - - // dont use getAttribute as it returns orginal value not resolved - return this._linkNode.href; - } - }else{ - if(modules.utils.isString(url)){ - return url; - } - return ''; - } - }, - - }; - - return modules; - -} (Modules || {})); |