mirror of
https://github.com/multipleofnpm/qthtml.git
synced 2026-01-13 16:17:56 +00:00
Bump version to 0.3.0 and add ontop method to $. Improve code consistency in index.js.
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
7
index.js
7
index.js
@@ -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')
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user