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 — Merge pull request #8467 from Connormiha/simplify-append-head · webpack/webpack@d5e26f7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/web
    • JsonpMainTemplate.runtime.js
    • JsonpMainTemplatePlugin.js
  • test/__snapshots__
    • StatsTestCases.test.js.snap
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/web/JsonpMainTemplate.runtime.js‎

Copy file name to clipboardExpand all lines: lib/web/JsonpMainTemplate.runtime.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ module.exports = function() {
1212

1313
// eslint-disable-next-line no-unused-vars
1414
function hotDownloadUpdateChunk(chunkId) {
15-
var head = document.getElementsByTagName("head")[0];
1615
var script = document.createElement("script");
1716
script.charset = "utf-8";
1817
script.src = $require$.p + $hotChunkFilename$;
1918
if ($crossOriginLoading$) script.crossOrigin = $crossOriginLoading$;
20-
head.appendChild(script);
19+
document.head.appendChild(script);
2120
}
2221

2322
// eslint-disable-next-line no-unused-vars
Collapse file

‎lib/web/JsonpMainTemplatePlugin.js‎

Copy file name to clipboardExpand all lines: lib/web/JsonpMainTemplatePlugin.js
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,8 @@ class JsonpMainTemplatePlugin {
282282
"promises.push(installedChunkData[2] = promise);",
283283
"",
284284
"// start chunk loading",
285-
"var head = document.getElementsByTagName('head')[0];",
286285
mainTemplate.hooks.jsonpScript.call("", chunk, hash),
287-
"head.appendChild(script);"
286+
"document.head.appendChild(script);"
288287
]),
289288
"}"
290289
]),
@@ -310,14 +309,13 @@ class JsonpMainTemplatePlugin {
310309
"var chunkPreloadData = chunkPreloadMap[chunkId];",
311310
"if(chunkPreloadData) {",
312311
Template.indent([
313-
"var head = document.getElementsByTagName('head')[0];",
314312
"chunkPreloadData.forEach(function(chunkId) {",
315313
Template.indent([
316314
"if(installedChunks[chunkId] === undefined) {",
317315
Template.indent([
318316
"installedChunks[chunkId] = null;",
319317
mainTemplate.hooks.linkPreload.call("", chunk, hash),
320-
"head.appendChild(link);"
318+
"document.head.appendChild(link);"
321319
]),
322320
"}"
323321
]),
@@ -388,14 +386,13 @@ class JsonpMainTemplatePlugin {
388386
withPrefetch
389387
? Template.asString([
390388
"// chunk prefetching for javascript",
391-
"var head = document.getElementsByTagName('head')[0];",
392389
"prefetchChunks.forEach(function(chunkId) {",
393390
Template.indent([
394391
"if(installedChunks[chunkId] === undefined) {",
395392
Template.indent([
396393
"installedChunks[chunkId] = null;",
397394
mainTemplate.hooks.linkPrefetch.call("", chunk, hash),
398-
"head.appendChild(link);"
395+
"document.head.appendChild(link);"
399396
]),
400397
"}"
401398
]),

0 commit comments

Comments
0 (0)
You are visitor 01402605 — 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.