Skip to content

Commit

Permalink
- Version: 1.1.10 Build 20240119
Browse files Browse the repository at this point in the history
	- 修复表格重复输出的bug。
	- 修复Invalid prop `attr`警告。
  • Loading branch information
road0001 committed Jan 19, 2024
1 parent b70d0f0 commit 8f890ab
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
4 changes: 4 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# JQuery DOM

- Version: 1.1.10 Build 20240119
- 修复表格重复输出的bug。
- 修复Invalid prop `attr`警告。

- Version: 1.1.9 Build 20240118
- 修复限制只有一个children时,无法被部分插件识别的bug。

Expand Down
60 changes: 32 additions & 28 deletions react.extensions.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ function reactDOMHtml(dom_tag,dom_attr,dom_html,dom_html_after){
tag:undefined,attr:undefined,html:undefined,
};
for(let cur of dom_tag){
cur={
...default_children,
...cur,
};
if(cur.$$typeof){
if(typeof cur==`object` && cur.$$typeof){
domFullObject.push(cur); // 已被React.createElement封装的情况下,不再重新封装
}else{
}else if(cur && typeof cur==`object`){
cur={
...default_children,
...cur,
};
domFullObject.push(reactDOMHtml(cur,undefined,undefined));
}
}
Expand Down Expand Up @@ -122,34 +122,38 @@ function reactDOMHtml(dom_tag,dom_attr,dom_html,dom_html_after){
//表格语法糖
if(typeof dom_attr==`object` && (typeof dom_attr.tbody==`object` || typeof dom_attr.tr==`object`)){
let reactDOMTbody={tag:`tbody`,children:[]};
let default_tr={
tag:`tr`,attr:undefined,html:undefined,children:[],
};
let default_td={
tag:`td`,attr:undefined,html:undefined,children:[],
}
let trList=dom_attr.tbody || dom_attr.tr;
for(let i=0; i<trList.length; i++){
let curTr=trList[i];
let tr={
...default_tr,
...curTr
let default_tr={
tag:`tr`,attr:undefined,html:undefined,children:[],
};
let default_td={
tag:`td`,attr:undefined,html:undefined,children:[],
}
for(let j=0; j<curTr.td.length; j++){
let curTd=curTr.td[j];
if(typeof curTd==`string`){
curTd={html:curTd};
let curTr=trList[i];
if(curTr){
let tr={
...default_tr,
...curTr
}
let td={
...default_td,
...curTd,
if(curTr.td){
for(let j=0; j<curTr.td.length; j++){
let curTd=curTr.td[j];
if(typeof curTd==`string`){
curTd={html:curTd};
}
let td={
...default_td,
...curTd,
}
delete td.td;
tr.children.push(td);
}
}
delete td.td;
tr.children.push(td);
delete tr.tr;
delete tr.td;
reactDOMTbody.children.push(tr);
}
delete tr.tr;
delete tr.td;
reactDOMTbody.children.push(tr);
}
delete dom_attr.tr;
delete dom_attr.tbody;
Expand Down

0 comments on commit 8f890ab

Please sign in to comment.