DEV: Moves SVG sprite to <discourse-assets> element (#17148)

Similar to #17145

This commit moves the SVG sprite container to the <discourse-assets> element.

There is 0 visual or functional changes in this PR. It just tidies up the element view in devTools.
This commit is contained in:
Joe 2022-06-20 20:58:50 +08:00 committed by GitHub
parent 9d86a2b567
commit 93b8811f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -28,6 +28,7 @@
<discourse-assets-json>
<bootstrap-content key="preloaded">
</discourse-assets-json>
<discourse-assets-icons></discourse-assets-icons>
</discourse-assets>
<bootstrap-content key="body">

View File

@ -7,7 +7,8 @@ export function loadSprites(spritePath, spriteName) {
if (!spriteContainer) {
spriteContainer = document.createElement("div");
spriteContainer.id = SVG_CONTAINER_ID;
document.body.appendChild(spriteContainer);
const spriteWrapper = document.querySelector("discourse-assets-icons");
spriteWrapper?.appendChild(spriteContainer);
}
let sprites = spriteContainer.querySelector(`.${spriteName}`);

View File

@ -78,6 +78,7 @@
<discourse-assets-json>
<div class="hidden" id="data-preloaded" data-preloaded="<%= preloaded_json %>"></div>
</discourse-assets-json>
<discourse-assets-icons></discourse-assets-icons>
</discourse-assets>
<%- if allow_plugins? %>