зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1573158 - Share one fragment across all consumers of places-popup r=surkov
This will avoid parsing the markup strings into fragments for every consumer. Differential Revision: https://phabricator.services.mozilla.com/D43846 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3481e20489
Коммит
41b4963af5
|
@ -34,6 +34,15 @@
|
|||
this.attachShadow({ mode: "open" });
|
||||
}
|
||||
|
||||
get fragment() {
|
||||
if (!this.constructor.hasOwnProperty("_fragment")) {
|
||||
this.constructor._fragment = MozXULElement.parseXULToFragment(
|
||||
this.markup
|
||||
);
|
||||
}
|
||||
return document.importNode(this.constructor._fragment, true);
|
||||
}
|
||||
|
||||
get markup() {
|
||||
return `
|
||||
<html:link rel="stylesheet" href="chrome://global/skin/global.css" />
|
||||
|
@ -55,9 +64,7 @@
|
|||
}
|
||||
|
||||
this.shadowRoot.textContent = "";
|
||||
this.shadowRoot.appendChild(
|
||||
MozXULElement.parseXULToFragment(this.markup)
|
||||
);
|
||||
this.shadowRoot.appendChild(this.fragment);
|
||||
|
||||
this._indicatorBar = this.shadowRoot.querySelector(
|
||||
"[part=drop-indicator-bar]"
|
||||
|
|
Загрузка…
Ссылка в новой задаче