GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — url: simplify native URL object construction · nodejs/node@540929d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • url.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/url.js‎

Copy file name to clipboardExpand all lines: lib/internal/url.js
+7-9Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,11 +1369,6 @@ function toPathIfFileURL(fileURLOrPath) {
13691369
return fileURLToPath(fileURLOrPath);
13701370
}
13711371

1372-
function NativeURL(ctx) {
1373-
this[context] = ctx;
1374-
}
1375-
NativeURL.prototype = URL.prototype;
1376-
13771372
function constructUrl(flags, protocol, username, password,
13781373
host, port, path, query, fragment) {
13791374
var ctx = new URLContext();
@@ -1386,10 +1381,13 @@ function constructUrl(flags, protocol, username, password,
13861381
ctx.query = query;
13871382
ctx.fragment = fragment;
13881383
ctx.host = host;
1389-
const url = new NativeURL(ctx);
1390-
url[searchParams] = new URLSearchParams();
1391-
url[searchParams][context] = url;
1392-
initSearchParams(url[searchParams], query);
1384+
1385+
const url = Object.create(URL.prototype);
1386+
url[context] = ctx;
1387+
const params = new URLSearchParams();
1388+
url[searchParams] = params;
1389+
params[context] = url;
1390+
initSearchParams(params, query);
13931391
return url;
13941392
}
13951393
setURLConstructor(constructUrl);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.