1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-04 05:32:13 +02:00

♻️ Refactore, add abort option

This commit is contained in:
2023-08-26 12:20:01 +02:00
parent 7f1506781f
commit a36786042b
6 changed files with 54 additions and 25 deletions

View File

@ -1,4 +1,3 @@
import { addSignalListener, isSignal } from './signals.js';
let namespace_curr= "html";
export function namespace(namespace){
namespace_curr= namespace==="svg" ? "http://www.w3.org/2000/svg" : namespace;
@ -6,8 +5,10 @@ export function namespace(namespace){
append(el){ namespace_curr= "html"; return el; }
};
}
import { typeOf } from './helpers.js';
import { isSignal, valueOfSignal } from './signals-common.js';
export function createElement(tag, attributes, ...connect){
if(typeof attributes==="string" || ( isSignal(attributes) /* TODO && isText*/ ))
if(typeOf(attributes)!=="[object Object]" || ( isSignal(attributes) && typeOf(valueOfSignal(attributes))!=="[object Object]" ))
attributes= { textContent: attributes };
let el;
switch(true){
@ -22,6 +23,7 @@ export function createElement(tag, attributes, ...connect){
}
export { createElement as el };
import { addSignalListener } from './signals-common.js';
export function assign(element, ...attributes){
if(!attributes.length) return element;
const is_svg= element instanceof SVGElement;