Merge pull request #871 from universe-st/PR-Branch-eff
因同步原因,去除MutatableObserver对getCards的优化逻辑
This commit is contained in:
commit
6b6ebfb2ef
|
@ -2271,14 +2271,8 @@ export class Get extends Uninstantable {
|
||||||
static *iterableChildNodes(node){
|
static *iterableChildNodes(node){
|
||||||
for(let i=0;i<arguments.length;i++){
|
for(let i=0;i<arguments.length;i++){
|
||||||
let arg = arguments[i];
|
let arg = arguments[i];
|
||||||
if(arg._childNodesWatcher){
|
for(let j=0;j<arg.childElementCount;j++){
|
||||||
for(let child of arg._childNodesWatcher.childNodes){
|
yield arg.childNodes[j];
|
||||||
yield child;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
for(let j=0;j<arg.childElementCount;j++){
|
|
||||||
yield arg.childNodes[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
export class ChildNodesWatcher{
|
export class ChildNodesWatcher{
|
||||||
constructor(dom){
|
constructor(dom){
|
||||||
|
this.dom = dom;
|
||||||
this.childNodes = [];
|
this.childNodes = [];
|
||||||
this.observer = new MutationObserver(mutationsList=>{
|
this.observer = new MutationObserver(mutationsList=>{
|
||||||
for (let mutation of mutationsList) {
|
for (let mutation of mutationsList) {
|
||||||
|
@ -16,7 +17,7 @@ export class ChildNodesWatcher{
|
||||||
}
|
}
|
||||||
|
|
||||||
onChildNodesChanged(addedNodes,removedNodes) {
|
onChildNodesChanged(addedNodes,removedNodes) {
|
||||||
this.childNodes.addArray(Array.from(addedNodes));
|
this.childNodes.addArray(Array.from(addedNodes).filter(node=>node.parentNode == this.dom));
|
||||||
this.childNodes.removeArray(Array.from(removedNodes));
|
this.childNodes.removeArray(Array.from(removedNodes));
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -3234,7 +3234,7 @@ export class Player extends HTMLDivElement {
|
||||||
value = getCardName(card);
|
value = getCardName(card);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value = cards[i][j];
|
value = card[j];
|
||||||
}
|
}
|
||||||
if ((typeof arg2[j] == 'string' && value != arg2[j]) ||
|
if ((typeof arg2[j] == 'string' && value != arg2[j]) ||
|
||||||
(Array.isArray(arg2[j]) && !arg2[j].includes(value))) {
|
(Array.isArray(arg2[j]) && !arg2[j].includes(value))) {
|
||||||
|
|
Loading…
Reference in New Issue