mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-26 20:57:13 +02:00
reworked html / javascript
This commit is contained in:
parent
1e5d788914
commit
148c8e2099
7 changed files with 173 additions and 338 deletions
|
@ -61,6 +61,23 @@ function ml(tagName, ...args) {
|
|||
return nester(el, args[1])
|
||||
}
|
||||
|
||||
function mlNs(tagName, ...args) {
|
||||
var el = document.createElementNS("http://www.w3.org/2000/svg", tagName);
|
||||
if(args[0]) {
|
||||
for(var name in args[0]) {
|
||||
if(name.indexOf("on") === 0) {
|
||||
el.addEventListener(name.substr(2).toLowerCase(), args[0][name], false)
|
||||
} else {
|
||||
el.setAttribute(name, args[0][name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!args[1]) {
|
||||
return el;
|
||||
}
|
||||
return nester(el, args[1])
|
||||
}
|
||||
|
||||
function nester(el, n) {
|
||||
if (typeof n === "string") {
|
||||
el.innerHTML = n;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue