Bug 1441284 - Part 4 - Remove redundant calls before _moveOutKids and simplify the function. r=Gijs

The main view is already included in the children of the view stack, so the code that moves it out separately can be removed. The "mainview" attribute is already set to the correct value the next time the view is opened.

MozReview-Commit-ID: B8LMAxWvvTb

--HG--
extra : rebase_source : ae8afd201782346e63772cdb62797b7069e0d3ac
This commit is contained in:
Paolo Amadini 2018-02-26 19:14:31 +00:00
Родитель d46beaba6f
Коммит 6a40e40b80
1 изменённых файлов: 4 добавлений и 13 удалений

Просмотреть файл

@ -443,14 +443,8 @@ var PanelMultiView = class extends this.AssociatedToNode {
return;
this._cleanupTransitionPhase();
let mainView = this._mainView;
if (mainView) {
if (this._panelViewCache)
this._panelViewCache.appendChild(mainView);
mainView.removeAttribute("mainview");
}
this._moveOutKids(this._viewStack);
this._moveOutKids();
this._panel.removeEventListener("mousemove", this);
this._panel.removeEventListener("popupshowing", this);
this._panel.removeEventListener("popuppositioned", this);
@ -601,19 +595,16 @@ var PanelMultiView = class extends this.AssociatedToNode {
* Remove any child subviews into the panelViewCache, to ensure
* they remain usable even if this panelmultiview instance is removed
* from the DOM.
* @param viewNodeContainer the container from which to remove subviews
*/
_moveOutKids(viewNodeContainer) {
_moveOutKids() {
if (!this._panelViewCache)
return;
// Node.children and Node.childNodes is live to DOM changes like the
// ones we're about to do, so iterate over a static copy:
let subviews = Array.from(viewNodeContainer.childNodes);
let subviews = Array.from(this._viewStack.childNodes);
for (let subview of subviews) {
// XBL lists the 'children' XBL element explicitly. :-(
if (subview.nodeName != "children")
this._panelViewCache.appendChild(subview);
this._panelViewCache.appendChild(subview);
}
}