Merge pull request #871 from universe-st/PR-Branch-eff

因同步原因,去除MutatableObserver对getCards的优化逻辑
This commit is contained in:
Spmario233 2024-01-28 18:04:53 +08:00 committed by GitHub
commit 6b6ebfb2ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 10 deletions

View File

@ -2271,14 +2271,8 @@ export class Get extends Uninstantable {
static *iterableChildNodes(node){
for(let i=0;i<arguments.length;i++){
let arg = arguments[i];
if(arg._childNodesWatcher){
for(let child of arg._childNodesWatcher.childNodes){
yield child;
}
}else{
for(let j=0;j<arg.childElementCount;j++){
yield arg.childNodes[j];
}
for(let j=0;j<arg.childElementCount;j++){
yield arg.childNodes[j];
}
}
}

View File

@ -3,6 +3,7 @@
*/
export class ChildNodesWatcher{
constructor(dom){
this.dom = dom;
this.childNodes = [];
this.observer = new MutationObserver(mutationsList=>{
for (let mutation of mutationsList) {
@ -16,7 +17,7 @@ export class ChildNodesWatcher{
}
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));
}
};

View File

@ -3234,7 +3234,7 @@ export class Player extends HTMLDivElement {
value = getCardName(card);
}
else {
value = cards[i][j];
value = card[j];
}
if ((typeof arg2[j] == 'string' && value != arg2[j]) ||
(Array.isArray(arg2[j]) && !arg2[j].includes(value))) {