Bump version to 0.3.0 and add ontop method to $. Improve code consistency in index.js.

This commit is contained in:
sss
2025-06-05 15:24:29 -07:00
parent 70698d20cd
commit cf3aaca28a
3 changed files with 6 additions and 5 deletions

View File

@@ -2,12 +2,12 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<script src="index.js"></script>
</head> </head>
<body> <body>
<h1>Testing index.js Module Import</h1> <h1>Testing index.js Module Import</h1>
<script type="module"> <script type="module">
import {$} from './index.js'
$('body').render(`new`) $('body').render(`new`)
</script> </script>

View File

@@ -1,10 +1,11 @@
export const $ = (selector) => const $ = (selector) =>
{ {
const el = document.querySelector(selector) const el = document.querySelector(selector)
el.render = (html) => el.innerHTML = html el.render = (html) => el.innerHTML = html
el.inject = (html) => el.insertAdjacentHTML('beforeend', html) el.inject = (html) => el.insertAdjacentHTML('beforeend', html)
el.ontop = (html) => el.insertAdjacentHTML('beforebegin', html)
return el; return el;
}; };
export const $$ = (selector) => return document.querySelectorAll(selector) const $$ = (selector) => { return document.querySelectorAll(selector)}
export const _ = msg => console.log(msg); // _('hello') const _ = msg => console.log(msg); // _('hello')

View File

@@ -1,6 +1,6 @@
{ {
"name": "qthtml", "name": "qthtml",
"version": "0.2.0", "version": "0.3.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",