mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-07-01 04:12:14 +02:00
🎉
This commit is contained in:
16
test/index.html
Normal file
16
test/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="no-js" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- DEL CSP https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | https://github.com/Prinzhorn/minimal-csp -->
|
||||
<!-- DEL https://github.com/jensimmons/cssremedy -->
|
||||
<link rel="stylesheet" href="https://github.com/jensimmons/cssremedy/raw/master/css/remedy.css">
|
||||
|
||||
<title>Small DOM element creation enhancements</title>
|
||||
<meta name="description" content="Making creatig elements easier">
|
||||
<script src="index.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
17
test/index.js
Normal file
17
test/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { el, elNS, assign } from "../index.js";
|
||||
Object.assign(globalThis, { el, elNS, assign });
|
||||
|
||||
console.log(el("p", { className: "red", textContent: "Hello "}));
|
||||
console.log(el("p", { className: "red", textContent: "Hello "}) instanceof HTMLParagraphElement);
|
||||
|
||||
document.head.append(
|
||||
el("style", { textContent: `
|
||||
.red{ color: red; }
|
||||
` })
|
||||
)
|
||||
document.body.append(
|
||||
el("p", { className: "red" }).append(
|
||||
el("", { textContent: "Hello " }),
|
||||
el("strong", { textContent: "World" })
|
||||
)
|
||||
);
|
Reference in New Issue
Block a user