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">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script src="index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing index.js Module Import</h1>
|
||||
|
||||
<script type="module">
|
||||
import {$} from './index.js'
|
||||
$('body').render(`new`)
|
||||
|
||||
</script>
|
||||
|
||||
7
index.js
7
index.js
@@ -1,10 +1,11 @@
|
||||
export const $ = (selector) =>
|
||||
const $ = (selector) =>
|
||||
{
|
||||
const el = document.querySelector(selector)
|
||||
el.render = (html) => el.innerHTML = html
|
||||
el.inject = (html) => el.insertAdjacentHTML('beforeend', html)
|
||||
el.ontop = (html) => el.insertAdjacentHTML('beforebegin', html)
|
||||
return el;
|
||||
};
|
||||
|
||||
export const $$ = (selector) => return document.querySelectorAll(selector)
|
||||
export const _ = msg => console.log(msg); // _('hello')
|
||||
const $$ = (selector) => { return document.querySelectorAll(selector)}
|
||||
const _ = msg => console.log(msg); // _('hello')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "qthtml",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
Reference in New Issue
Block a user