add attr linq generate.

This commit is contained in:
Rintim 2023-09-28 19:10:04 +08:00
parent b6b4d10bef
commit a662ae8afa
1 changed files with 18 additions and 1 deletions

View File

@ -7823,7 +7823,17 @@
switch (item.constructor) {
case Object:
case null:
result.style=item;
if("_type" in item){
const type=item["_type"];
if(!(type in result)) result[type]=lib.creation.nullObject;
result[type][item.name]=item.value;
}
else{
if(!("style" in result)) result.style=lib.creation.nullObject;
for(const name in item){
result.style[name]=item[name];
}
}
break;
default:
if(!("childs" in result)) result.childs=lib.creation.array;
@ -7843,6 +7853,13 @@
}
return result;
},
attr(name,value){
return {
_type:"attributes",
name:name,
value:value
}
},
div(){
const dom=lib.linq.dom;
return dom.inject(document.createElement("div"),dom.generate(...arguments));