UNPKG

browsernizr

Version:

Modernizr wrapper for use with browserify

29 lines (27 loc) 669 B
/*! { "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. */ var Modernizr = require('./../../lib/Modernizr.js'); 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; } });