According to the documentation https://developer.mozilla.org/ru/docs/Web/API/Element/insertAdjacentHTML the insertAdjacentElement function can only add an element object, and the insertAdjacentText function can only add the primitive data type "tex".
Example of successful code execution:
const app = document.getElementById("app");
// Successfully add the element to the beginning of the app container
const div = document.createElement("div");
app.insertAdjacentElement("afterbegin", div);
// Successfully add the primitve text to the beginning of the app container
app.insertAdjacentElement("afterbegin", "...other text...");
But when I want to add a Text object, then of course an error is displayed, since insertAdjacentElement only supports Element object, example:
const app = document.getElementById("app");
const text = document.createTextNode("123");
app.insertAdjacentElement("afterbegin", text ); // Uncaught TypeError: Failed to execute 'insertAdjacentElement' on 'Element': parameter 2 is not of type 'Element'.
Specify, please, you can add a Text object as quickly as possible in speed (namely document.createTextNode ("123"), PRIMARY TEXT DOES NOT FIT !!! or NOT document.createTextNode ("123").data) to the beginning of the app container?
P.S. insertAdjacentText and insertAdjacentHTML are NOT the same as you need to add the Text object!