mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-18 07:31:04 +00:00
29 lines
663 B
JavaScript
29 lines
663 B
JavaScript
/*!
|
|
{
|
|
"name": "URL parser",
|
|
"property": "urlparser",
|
|
"notes": [{
|
|
"name": "WHATWG Spec",
|
|
"href": "https://url.spec.whatwg.org/"
|
|
}],
|
|
"polyfills": ["urlparser"],
|
|
"authors": ["Ron Waldon (@jokeyrhyme)"],
|
|
"tags": ["url"]
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Check if browser implements the URL constructor for parsing URLs.
|
|
*/
|
|
define(['Modernizr'], function(Modernizr) {
|
|
Modernizr.addTest('urlparser', function() {
|
|
var url;
|
|
try {
|
|
// have to actually try use it, because Safari defines a dud constructor
|
|
url = new URL('http://modernizr.com/');
|
|
return url.href === 'http://modernizr.com/';
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
});
|
|
});
|