main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
801 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var getBuiltIn = require('../internals/get-built-in');
|
---|
| 4 | var validateArgumentsLength = require('../internals/validate-arguments-length');
|
---|
| 5 | var toString = require('../internals/to-string');
|
---|
| 6 | var USE_NATIVE_URL = require('../internals/url-constructor-detection');
|
---|
| 7 |
|
---|
| 8 | var URL = getBuiltIn('URL');
|
---|
| 9 |
|
---|
| 10 | // `URL.parse` method
|
---|
| 11 | // https://url.spec.whatwg.org/#dom-url-canparse
|
---|
| 12 | $({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, {
|
---|
| 13 | parse: function parse(url) {
|
---|
| 14 | var length = validateArgumentsLength(arguments.length, 1);
|
---|
| 15 | var urlString = toString(url);
|
---|
| 16 | var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]);
|
---|
| 17 | try {
|
---|
| 18 | return new URL(urlString, base);
|
---|
| 19 | } catch (error) {
|
---|
| 20 | return null;
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.