@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.58 kB
JavaScript
import*as i18n from"../../core/i18n/i18n.js";import*as SDK from"../../core/sdk/sdk.js";import{AffectedElementsView}from"./AffectedElementsView.js";const UIStrings={nDocuments:"{n, plural, =1 { document} other { documents}}",documentInTheDOMTree:"Document in the DOM tree",url:"URL",mode:"Mode"},str_=i18n.i18n.registerUIStrings("panels/issues/AffectedDocumentsInQuirksModeView.ts",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class AffectedDocumentsInQuirksModeView extends AffectedElementsView{#e=Promise.resolve();update(){this.#e=this.#e.then(this.#t.bind(this))}getResourceName(e){return i18nString(UIStrings.nDocuments,{n:e})}async#t(){this.clear(),await this.#n(this.issue.getQuirksModeIssues())}async#s(e){const t=document.createElement("tr");t.classList.add("affected-resource-quirks-mode");const n=e.details(),s=SDK.FrameManager.FrameManager.instance().getFrame(n.frameId)?.resourceTreeModel().target()||null;t.appendChild(await this.createElementCell({nodeName:"document",backendNodeId:n.documentNodeId,target:s},e.getCategory())),this.appendIssueDetailCell(t,n.isLimitedQuirksMode?"Limited Quirks Mode":"Quirks Mode"),this.appendIssueDetailCell(t,n.url),this.affectedResources.appendChild(t)}async#n(e){const t=document.createElement("tr");this.appendColumnTitle(t,i18nString(UIStrings.documentInTheDOMTree)),this.appendColumnTitle(t,i18nString(UIStrings.mode)),this.appendColumnTitle(t,i18nString(UIStrings.url)),this.affectedResources.appendChild(t);let n=0;for(const t of e)n++,await this.#s(t);this.updateAffectedResourceCount(n)}}