Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f9c25b

Browse files
authored
Update fasthtml.js
1 parenta7dbef1 commit2f9c25b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

‎fasthtml.js‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
exportfunction$(sel,root=document){returnroot.querySelector(sel)}
2-
exportfunction$$(sel,root=document){returnroot.querySelectorAll(sel)}
3-
exportfunction$H(ss, ...values){
1+
function_$(sel,root=document){returnroot.querySelector(sel)}
2+
function_$$(sel,root=document){returnroot.querySelectorAll(sel)}
3+
function$H(ss, ...values){
44
constr=document.createElement('div');
55
r.innerHTML=ss.reduce((r,s,i)=>r+s+(values[i]||''),'').trim();
66
returnr.firstElementChild;
77
}
88

9-
exportfunction$E(t,attrs={},children=[]){
9+
function$E(t,attrs={},children=[]){
1010
if(typeoft==='string'){
1111
const{ style, dataset, className, cls, ...rest}=attrs;
1212
conste=document.createElement(t);
@@ -31,22 +31,28 @@ export function $E(t, attrs = {}, children = []) {
3131
}elsereturnt;
3232
}
3333

34-
exportfunctionproc_htmx(sel,func){
34+
functionproc_htmx(sel,func){
3535
htmx.onLoad(elt=>{
3636
constelements=Array.from(htmx.findAll(elt,sel));
3737
if(elt.matches(sel))elements.unshift(elt)
3838
elements.forEach(func);
3939
});
4040
}
4141

42-
exportfunctiondomReadyExecute(cb){
42+
functiondomReadyExecute(cb){
4343
if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",cb)
4444
elsecb();
4545
}
4646

47-
if(typeofwindow!=='undefined'){
48-
window.$E=$E;
49-
window.$H=$H;
50-
window.proc_htmx=proc_htmx;
51-
window.domReadyExecute=domReadyExecute;
47+
console.log(exports);
48+
console.log('hi');
49+
50+
if(typeofexports!=='undefined'){
51+
console.log('exports');
52+
exports.$=_$;
53+
exports.$$=_$$;
54+
exports.$E=$E;
55+
exports.$H=$H;
56+
exports.proc_htmx=proc_htmx;
57+
exports.domReadyExecute=domReadyExecute;
5258
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp