How i save. Canvas in db. With background. Which comes from user uploaded in Django field img

I successfully save if static path
How pass field image of customer to java
There many trial but src for field from model i cant save both i f i add url in style background not saved your text

type h

window.onload = function(){

  //var dataImage = localStorage.getItem('imgData');



  //var canvas = document.getElementById("myCanvas");

  var context = canvas.getContext("2d");

  var imageObj = new Image();

  var dataURL = canvas.toDataURL("image/png");

  imageObj.onload = function(){

    context.globalCompositeOperation="destination-over";

    context.drawImage(imageObj,250, 50,700,400);// i edit it was  context.drawImage(imageObj,50, 50);

    context.font = "40pt Comic Sans MS";

    context.fillText("draw here",20,80);

    context.fill();

    context.globalAlpha = 0.5;



  };



  //function getBase64Image(img) {

      //var dataURL = canvas.toDataURL("image/png");



      //return dataURL.replace(/^data:image/(png|jpg);base64,/, "");

  //}





  //here source imge for back ground if you want make it dynamic from upload by user  use url of media   <canvas  style="background: url('{{ user.profile.profile_pic.url }}')" <canvas  style="background: url({% static 'images/aes.png'%})"

  imageObj.src = dataURL;//"data:image/png;base64," + dataImage;//'/media/imggg/gggg.png';//"{{ img }}"//'/media/imggg/gggg.png';



  //cnanvas.innerHTML = `<img src="${url}" width="50%">`;//`media/${object.img.url}`//("<img src="{{ MEDIA_URL}}{{field.img.url}}">"); //<img src="{{ MEDIA_URL}}{{ City.image.url }}">"url '(${field.img.url})' ";//=("<img src='${{field.img.url}}'>");

  };

ere




    </main>
</body>


<script type="text/javascript">

</script>

</html>


Can pass variable from Django models and view to java
Ok any other help i needs
Edited code how make dynamic uploaded pic background drawing on it then save

Firefox fails to load picture elements with srcset, while Chrome and Edge successfully load photos

I’m attempting to use picture elements for the first time, and I’m trying to figure out what is wrong with my srcset syntax.

Chrome and Edge successfully load photos with the srcset attributes included like this:

<picture style="position: absolute;">
  <source srcset="https://example.com/h-768.webp,https://example.com/mh-1728.webp 2x,https://example.com/h-1728.webp 3x" media="(max-height: 768px)">
  <source srcset="https://example.com/h-1080.webp,https://example.com/h-1728.webp 2x,https://example.com/h-2796.webp 3x" media="(max-height: 864px)">
  <source srcset="https://example.com/h-1080.webp,https://example.com/h-2796.webp 2x," media="(max-height: 932px)">
  <source srcset="https://example.com/h-2796.webp" media="(min-height: 1081px)">
  <img src="https://example.com/h-768.webp" alt="alt" class="class">
</picture>

Firefox displays the alt text instead of the image, and when hovering over the element in the Inspector, displays the message “Could not load the image”, although no errors are logged.

Firefox successfully loads the image if the srcset attributes are removed from the source elements:

<picture style="position: absolute;">
  <source media="(max-height: 768px)">
  <source media="(max-height: 864px)">
  <source media="(max-height: 932px)">
  <source media="(min-height: 1081px)">
  <img src="https://example.com/h-768.webp" alt="alt" class="class">
</picture>

What’s the correct syntax for using srcset in Firefox?

Thanks!

Header Logo is showing in all pages except one? nothing is changed and Im calling the Header Component from src/pages only

I have a logo in my header component, which i’m calling in every page to show at the top, for some reason its rendered in every page except this one page,and no matter what image I call, it doesn’t render, I even tried to put straight image tag instead of header. still didn’t get rendered? can somebody help?my header
tried putting tag directly in the specific page that also didn’t work?

Safari Web Extension messaging not working as expected

I’m trying to send a message from my popup.js to my content.js script but the content.js script is not receiving it. content.js seems to not receive messages from popup or background scripts.

popup.js

window.onload = function() {
    browser.tabs.query({active: true, currentWindow: true}, function(tabs) {
        browser.tabs.sendMessage(tabs[0].id, { greeting: "hello from the popup" });
        browser.runtime.sendMessage({ tabId: tabs[0].id, greeting: "Going to background?"});
        debugger;
    });
}

content.js

browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
    console.log("Received request: ", request);
    return true;
});

background.js — this one does receive the message

browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
    console.log("Received request in the bg: ", request);

    browser.tabs.sendMessage(request.tabId, "Sent from bg");
});

manifest.json

{
    "manifest_version": 3,

    "name": "__MSG_extension_name__",
    "description": "__MSG_extension_description__",
    "version": "1.0",

    "background": {
        "scripts": [ "background.js" ],
        "type": "module"
    },

    "content_scripts": [{
        "js": [ "content.js" ],
        "matches": [ "*://*/*" ],
        "run_at": "document_end",
    }],

    "action": {
        "default_popup": "popup.html",
        "default_icon": "images/toolbar-icon.svg"
    },

    "permissions": [
        "activeTab",
        "nativeMessaging"
    ]
}

i am trying to open a folder containing html and css file but the vscode is getting refreshed?

i’ve taken a udemy web dev course and now i’ve reached css part but the folder she has provided isn’t opening on vscode. before i’ve completed all the html projects . this is the first folder with css file in it. what could be the reason behind getting refreshed. i am stuck.

downloaded the zip file.
extracted it .
tried to open the extracted folder in the vscode.
nothing shows up. not even the html files in it.

javascript multiple array filters based on true / false [duplicate]

sample of the json data

[
    {
        "contactID": 1,
        "isRecurring": true,
        "isActive": true,
        "isEmailSubscriber": true,
        "coords": [123,123]
    },
    {
        "contactID": 2,
        "isRecurring": false,
        "isActive": true,
        "isEmailSubscriber": false,
        "coords": [123,123]
    },
    {
        "contactID": 3,
        "isRecurring": true,
        "isActive": false,
        "isEmailSubscriber": true,
        "coords": [123,123]
    }
]

i’m trying to build a heat map that starts initally loaded with all markers. i have built a card with filters that i woujld like to filter the heatmap at any time and toggle any combination of filters. i can’t seem to make it work for the life of me. any help would be greatly appreciated.

filter card

How to skip failing part in Cypress test script

what is expected from the below code is get_plz_ChooseGroup will be skipped and not trigger a test failure if the element is not visible after 5000 seconds

Login_Page_POS.get_plz_ChooseGroup({ timeout: 5000 })
            .then(($element) => {
              if ($element.is(":visible")) {
                Login_Page_POS.chooseGroup(groupName)
              } else {
                cy.log("Element not visible after 5 seconds, skipping this part")
              }
            })
            .catch(() => {
              cy.log("Element not found after 5 seconds, skipping this part")
            })

and :

  this.plz_group_Label = "//span[contains(text(),'Please choose your group')]"
      get_plz_ChooseGroup() {
        return cy.xpath(this.plz_group_Label)
      }

fails at .catch(() => {:

_Login_Page_POS.default.get_plz_ChooseGroup(...).then(...).catch is not a function

Angular Component is not updating after state change

I’m coming from React and I’m liking Angular 18 so far. However I’m struggling with trying to understand how components work in angular, specifically updating the DOM from a child component.

I have a parent component that has 2 children, one is angular component and the other is just a div. Both should theoretically do the same thing. What i want do is ‘tab’ from certain views. So from the parent component I can tab to either view. I do this with a simple function goBack function that changes the currentTab variable. this works in the regular div element just fine, but in the angular component when I pass the Input (and log the result from the parent component), it shows that the variable or state has changed, but the view has not changed. To render the different views I’m using *ngIf. I’ve noticed similar issues with angular components not behaving as expected and I’m wondering why.

Here is a little snippit to help further elaborate my issue.

Parent Component.html


<div class="container"> <div *ngIf="currentTab === 'chose-options'" class="button-container"> <button (click)="choseGameOption('new-game')" value="new-game" type="button" class="button" > <p>New Game</p> </button> <button (click)="choseGameOption('saved-game')" value="saved-game" type="button" class="button" > Saved Game </button> </div>

<div *ngIf="currentTab === 'new-game'"> <app-jeopardy-game-board [goBack]="goBack"></app-jeopardy-game-board> <button (click)="goBack()">go back</button> </div>

<div *ngIf="currentTab === 'saved-game'"> <p>Choose saved game</p> <button (click)="goBack()">back</button> </div> </div>

Parent component.ts

export class JeopardyComponent {
  @ViewChild(AddJeopardyQuestionComponent)
  dialog!: AddJeopardyQuestionComponent;
  currentTab: string = 'chose-options';
  private cd: ChangeDetectorRef = inject(ChangeDetectorRef);

  choseGameOption(gameOption: string) {
    this.currentTab = gameOption;
    this.cd.detectChanges();
  }
  goBack() {
    this.currentTab = 'chose-options';
    console.log(this.currentTab);
  }
}

Child component.html:


// ... misc. table data (no other logic)

<button (click)="onBackClick()">
        <mat-icon>keyboard_arrow_left</mat-icon>
      </button>

Child component.ts


import { CommonModule } from '@angular/common';
import { Component, Input, Output } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';


@Component({
  selector: 'app-jeopardy-game-board',
  standalone: true,
  imports: [MatIconModule, CommonModule],
  templateUrl: './jeopardy-game-board.component.html',
  styleUrl: './jeopardy-game-board.component.scss',
})
export class JeopardyGameBoardComponent {
  @Input() goBack!: () => void;

  // @Output() viewEvent: EventEmitter = new EventEmitter();

  onBackClick() {
    this.goBack();
    // this.viewEvent.emit();
  }
}

I’ve tried using a a ChangeDetectorRef, ViewChild(), Outputting EventEmmiters, nothing seems to be updating the UI the way it is for the regular div element
Sorry if my terminology is off, I’m still very new to angular

Adding active class to in-page nav using IntersectionObserver not working on tall elements

I am building a sidebar nav for a page with a lot of content in it, which scrolls to the associated section when clicked. I would like to also add a class to the currently visible section as you scroll down the page using IntersectionObserver. I have it partially working, but only when the element in question is short enough to fit entirely within the currently viewed portion of the page. If the element is taller than the page, it never triggers the intersecting. I have tried playing around with the rootMargin and threshold values but I am at a loss.

In the example, the only two sections that work properly are #lorem and #sit since they are shorter sections. Any thoughts as to where I am going wrong?

const changeNav = (entries, observer) => {
    entries.forEach((entry) => {
        if (entry.isIntersecting && entry.intersectionRatio >= 1) {
            document.querySelector('.is-active').classList.remove('is-active');
            let id = entry.target.getAttribute('id');
            document.querySelector(`[href="#${id}"]`).classList.add('is-active');
        }
    });
}

const options = {
    rootMargin: "0px",
    threshold: 1
}

const observer = new IntersectionObserver(changeNav, options);

const sections = document.querySelectorAll('section');
sections.forEach((section) => {
    observer.observe(section);
});
.container {
  width:500px;
  margin:0 auto;
}

#lorem {
  height:200px;
  background:blue;
}

#ipsum {
  height:1500px;
  background:red;
}

#dolor {
  height:1200px;
  background:green;
}

#sit {
  height:100px;
  background:yellow;
}

#amet {
  height:1600px;
  background:purple;
}

ul {
  position:fixed;
  top:0;
  left:0;
  padding:5px 0 5px 5px;
  list-style-type:none;
}

  li a {
    color:gray;
    text-decoration:none;
  }
  
  .is-active {
    text-decoration:underline;
    color:black;
  }
<div class="container">
  <section id="lorem"></section>
  <section id="ipsum"></section>
  <section id="dolor"></section>
  <section id="sit"></section>
  <section id="amet"></section>
</div>

<ul>
  <li><a href="#lorem" class="is-active">Lorem</a></li>
  <li><a href="#ipsum">Ipsum</a></li>
  <li><a href="#dolor">Dolor</a></li>
  <li><a href="#sit">Sit</a></li>
  <li><a href="#amet">Amet</a></li>
</ul>

How do JS Libs execute things on variables in a chain or as a singe?

I cant find how to do this or know the terminology so excuse me if this may be a duplicate.

How do I take a variable and add something like this to it:


let x = document.createElement("p");

x.pickle(); 

//let's say ".pickle" turns the text green. I do not want to use a normal function to do this like `setAtrribute` I want to do it through my own custom thing like ".pickle"


How do I do this as JS libraries do? Even if my example needs to be changed to make it work.

NextJS -Server-side filtering of map-data

My requirements:

  • Fetch data from DB in server component
  • Show that data via markers on a map in child client component
  • The data fetching should include filters in the DB query depending on the map bounds. So on panning or zooming, I would like to refetch the data and filter so that only the ones that are visible in the map are fetched.

How would I achieve that?

So far:

  • I fetch everything at once in a client component, keep it in state
  • I have an idle-listener on my google map. On changing the viewport I use the bounds.contains() function from google map to filter the local state to only render the markers visible in the current map viewport.
    This doesn’t scale though especially once I have hundreds or thousands of data points.

Other relevant information

  • My data points have a lat and lng fields in the database
  • I use prisma and postgres

merge javascript objects in array

I’m trying to merge an array of object by removing the ones which have the same code attribute and computing its times attribute.

given the following array:

let itemsTimes = [
    {
        item: {
            code: '0.05'
        },
        times: 1
    },
    {
        item: {
            code: '0.01'
        },
        times: 1
    },
    {
        item: {
            code: '0.02'
        },
        times: 1
    },
    {
        item: {
            code: '0.01'
        },
        times: 1
    },
    {
        item: {
            code: '0.02'
        },
        times: 2
    }
];

and the following code:

let mergedItemTimes = [];

itemsTimes.forEach((itemTime, i) => {
    let j = i + 1
    if ((itemsTimes[j])) {
        itemsTimes.forEach((_, j) => {
            if (itemTime.item.code === itemsTimes[j].item.code) {
                itemTime.times += itemsTimes[j].times
                itemsTimes.splice(j, 1)
            }
        })
    }
    mergedItemTimes.push(itemTime)
})

The expected output it’ll be:

[
    { item: { code: '0.05' }, times: 1 },
    { item: { code: '0.01' }, times: 2 },
    { item: { code: '0.02' }, times: 3 },
]

but it’s giving me:

[
    { item: { code: '0.05' }, times: 2 },
    { item: { code: '0.02' }, times: 4 },
]

Thanks in advance.

Extra div Element in Chrome Developer Tools

I’m using an HTML editor that I built, which you can access here: HTML Editor.

Here’s the relevant source code:

const previewer = document.querySelector('iframe'),
  editor = document.querySelector('textarea'),
  previewSelector = document.getElementById('previewSelector'),
  downloadLink = document.getElementById('downloadLink'),
  fontSizeSelector = document.getElementById('fontSizeSelector'),
  runButton = document.getElementById('runButton'),
  fileInput = document.getElementById('fileInput'),
  editorSizeInput = document.getElementById('editorSizeInput'),
  editorWrapper = document.getElementById('editorWrapper'),
  previewerWrapper = document.getElementById('previewerWrapper'),
  editorSizeOutput = document.querySelector('output'),
  verticalViewToggle = document.getElementById('verticalViewToggle'),
  mainContainer = document.querySelector('main'),
  darkEditorToggle = document.getElementById('darkEditorToggle'),
  spellcheckToggle = document.getElementById('spellcheckToggle'),
  footerContainerToggle = document.getElementById('footerContainerToggle'),
  footerContainer = document.querySelector('footer'),
  copyNotification = document.getElementById('copyNotification');
let previewTimeout = null;

function toggleClass(element, className, force) {
  element.classList.toggle(className, force);
}

function preview() {
  previewer.replaceWith(previewer); // a fresh iframe to delete JavaScript variables
  const previewerDocument = previewer.contentDocument;
  previewerDocument.write(editor.value);
  previewerDocument.close();
}

function timedPreview() {
  const previewSelectorValue = previewSelector.value;
  if (previewSelectorValue === 'Instant') {
    preview();
  } else if (previewSelectorValue !== 'Manual') {
    clearTimeout(previewTimeout);
    previewTimeout = setTimeout(preview, previewSelectorValue);
  }
}

function createDownloadURL() {
  const blob = new Blob([editor.value], {
    type: 'text/html; charset=utf-8'
  });
  downloadLink.href = URL.createObjectURL(blob);
}

function resizeFont() {
  editor.style.fontSize = fontSizeSelector.value + 'px';
}

function toggleRunButton() {
  toggleClass(runButton, 'hidden', previewSelector.value !== 'Manual');
}

function resizeEditor() {
  const editorSizeInputValue = editorSizeInput.value;
  editorWrapper.style.flexGrow = editorSizeInputValue;
  previewerWrapper.style.flexGrow = 100 - editorSizeInputValue;
  editorSizeOutput.value = (editorSizeInputValue / 100).toFixed(2);
}

runButton.addEventListener('click', preview);

editor.addEventListener('input', timedPreview);

downloadLink.addEventListener('click', createDownloadURL);
downloadLink.addEventListener('contextmenu', createDownloadURL);

fontSizeSelector.addEventListener('change', resizeFont);

previewSelector.addEventListener('change', toggleRunButton);

editorSizeInput.addEventListener('input', resizeEditor);

document.getElementById('resetButton').addEventListener('click', function() {
  if (!editor.value || editor.value !== editor.defaultValue && confirm('Your input will be lost.nAre you sure you want to reset?')) {
    fileInput.value = '';
    downloadLink.download = 'template.html';
    editor.value = editor.defaultValue;
    timedPreview();
  }
});

document.getElementById('selectButton').addEventListener('click', function() {
  editor.select();
});

fileInput.addEventListener('change', async function() {
  const file = this.files[0];
  if (file) { // to ensure that there's a file to read so Chrome, for example, doesn't run this function when you cancel choosing a new file
    downloadLink.download = file.name;
    editor.value = await file.text();
    timedPreview();
  }
});

verticalViewToggle.addEventListener('click', function() {
  toggleClass(mainContainer, 'vertical');
  toggleClass(this, 'active');
});

darkEditorToggle.addEventListener('click', function() {
  toggleClass(editor, 'dark');
  toggleClass(this, 'active');
});

spellcheckToggle.addEventListener('click', function() {
  editor.spellcheck = !editor.spellcheck;
  toggleClass(this, 'active');
});

footerContainerToggle.addEventListener('click', function() {
  toggleClass(footerContainer, 'hidden');
  toggleClass(this, 'active');
});

document.getElementById('copyButton').addEventListener('click', function() {
  navigator.clipboard.writeText(location);
  toggleClass(copyNotification, 'hidden');
  setTimeout(toggleClass, 2000, copyNotification, 'hidden');
});

// Save the current state to localStorage.
document.addEventListener('visibilitychange', function() {
  if (document.hidden) {
    const currentState = {
      spellcheckToggle: spellcheckToggle.className,
      verticalViewToggle: verticalViewToggle.className,
      darkEditorToggle: darkEditorToggle.className,
      footerContainerToggle: footerContainerToggle.className,
      previewSelector: previewSelector.value,
      fontSizeSelector: fontSizeSelector.value,
      editorSizeInput: editorSizeInput.value,
      editor: editor.value,
    };
    localStorage.setItem('state', JSON.stringify(currentState));
  }
});

// Restore the state from localStorage.
const restoredState = JSON.parse(localStorage.getItem('state'));
if (restoredState) {
  spellcheckToggle.className = restoredState.spellcheckToggle;
  verticalViewToggle.className = restoredState.verticalViewToggle;
  darkEditorToggle.className = restoredState.darkEditorToggle;
  footerContainerToggle.className = restoredState.footerContainerToggle;
  previewSelector.value = restoredState.previewSelector;
  fontSizeSelector.value = restoredState.fontSizeSelector;
  editorSizeInput.value = restoredState.editorSizeInput;
  editor.value = restoredState.editor;
}

// Update the UI based on the restored state.
editor.spellcheck = spellcheckToggle.classList.contains('active');
toggleClass(mainContainer, 'vertical', verticalViewToggle.classList.contains('active'));
toggleClass(editor, 'dark', darkEditorToggle.classList.contains('active'));
toggleClass(footerContainer, 'hidden', !footerContainerToggle.classList.contains('active'));
toggleRunButton();
resizeFont();
resizeEditor();
timedPreview();
html,
body {
  height: 100%;
  padding: 0;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
}

header,
footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 5px;
}

header {
  background: linear-gradient(#FFF, #CCC);
}

footer {
  background: linear-gradient(#CCC, #FFF);
}

main {
  display: flex;
  flex: 1;
}

main.vertical {
  flex-direction: column;
}

header *,
footer * {
  font: 0.75rem Arial;
  color: #333;
}

select,
button,
input {
  margin: 0;
}

label[for="editorSizeInput"],
address {
  margin-left: auto;
}

#editorSizeInput,
iframe {
  padding: 0;
}

output {
  font-family: monospace;
}

.toggle {
  padding: 2px 6px;
  border: 1px solid #666;
  border-radius: 12px;
  background: transparent;
}

#footerContainerToggle {
  width: 16px;
  height: 16px;
  padding: 0;
  border-bottom-width: 5px;
  border-radius: 0;
}

.active {
  border-color: #333;
  background: #FFF;
}

#copyButton {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

img {
  display: block;
}

div {
  position: relative;
}

#previewerWrapper {
  border-left: 5px solid #CCC;
}

main.vertical #previewerWrapper {
  border-left: 0;
  border-top: 5px solid #CCC;
}

div * {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  background: #FFF;
}

textarea {
  box-sizing: border-box;
  padding: 5px;
  outline: 0;
  resize: none;
  color: #333;
}

textarea.dark {
  background: #333;
  color: #FFF;
}

.hidden {
  display: none;
}
<header>
  <a href="" download="template.html" id="downloadLink" title="Download HTML document">Download</a>
  <label for="fontSizeSelector">Font size</label>
  <select id="fontSizeSelector">
    <option>12</option>
    <option>13</option>
    <option selected>14</option>
    <option>15</option>
    <option>16</option>
    <option>17</option>
    <option>18</option>
    <option>19</option>
    <option>20</option>
  </select>
  <label for="previewSelector">Preview</label>
  <select id="previewSelector">
    <option>Instant</option>
    <optgroup label="Delayed">
      <option value="500" selected>0.5 s</option>
      <option value="1000">1 s</option>
      <option value="1500">1.5 s</option>
      <option value="2000">2 s</option>
    </optgroup>
    <option>Manual</option>
  </select>
  <button type="button" id="runButton">Run</button>
  <button type="button" id="resetButton">Reset</button>
  <button type="button" id="selectButton">Select</button>
  <input type="file" accept="text/html" id="fileInput">
  <label for="editorSizeInput">Editor size</label>
  <input type="range" id="editorSizeInput">
  <output for="editorSizeInput"></output>
  <button type="button" class="toggle" id="verticalViewToggle">Vertical view</button>
  <button type="button" class="toggle" id="darkEditorToggle">Dark editor</button>
  <button type="button" class="toggle" id="spellcheckToggle">Spellcheck</button>
  <button type="button" class="toggle" id="footerContainerToggle" title="Toggle footer"></button>
</header>
<main>
  <div id="editorWrapper">
    <textarea><!doctype html>
<html lang="en">
<head>
  <title>HTML Document Template</title>
  <style>
    p {
      font-family: Arial;
    }
  </style>
</head>
<body>
  <p>Hello, world!</p>
  <script>
    console.log(document.querySelector('p').textContent);
  </script>
</body>
</html></textarea>
  </div>
  <div id="previewerWrapper">
    <iframe></iframe>
  </div>
</main>
<footer>
  <span>Share</span>
  <a href="https://x.com/intent/post?text=HTML%20Editor%3A%20online%20HTML%20editor%20with%20real-time%20preview&url=https%3A%2F%2Fhtmleditor.gitlab.io" target="_blank"><img src="images/x.svg" width="16" height="16" alt="X"></a>
  <a href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fhtmleditor.gitlab.io&t=HTML%20Editor%3A%20online%20HTML%20editor%20with%20real-time%20preview" target="_blank"><img src="images/facebook.svg" width="16" height="16" alt="Facebook"></a>
  <a href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fhtmleditor.gitlab.io" target="_blank"><img src="images/linkedin.svg" width="16" height="16" alt="LinkedIn"></a>
  <a href="mailto:?subject=HTML%20Editor%3A%20online%20HTML%20editor%20with%20real-time%20preview&body=https%3A%2F%2Fhtmleditor.gitlab.io" target="_blank"><img src="images/email.svg" width="16" height="16" alt="Email"></a>
  <button type="button" id="copyButton"><img src="images/link.svg" width="16" height="16" alt="Link"></button>
  <span id="copyNotification" class="hidden">Copied!</span>
  <address><a href="https://codereview.stackexchange.com/questions/293330/html-editor-online-html-editor-with-real-time-preview" title="Code Review Stack Exchange">Feedback</a> | Created by <a href="https://mori.pages.dev" rel="author">Mori</a></address>
</footer>

However, when I inspect the resulting page in Chrome Developer Tools (version 127.0.6533.120 on Windows 10), I notice an unexpected div element at the end of the body:

<div id="cccTost"></div>

This div isn’t in my source code, and I’m curious where it’s coming from and why it’s being added. Here’s a screenshot showing the extra div in the DOM:

Extra div Element in Chrome Developer Tools

Can anyone explain what might be causing this and how to prevent it?

github pages failing to show images

I am trying to make a portfolio and have been struggling for hours to get the images to show on the deployed github pages website. This is how I am embedding the images:

function HomePage() { const projects = [ { id: 1, name: 'Cone Map', description: 'Generated a cone map... ', imagePath: 'cone_map.png' }...

I have tried slash in front, no slash, dot slash, the github link to the image, and the complete path. None of them worked when I deploy the website, the images showed fine locally with just a slash in front. The images are uploaded to github.

Btw the way I got the website to deploy was by changing the build folder’s name to docs since it was the only directory name available to choose.