Commit 8906ca0d authored by timothy@apple.com's avatar timothy@apple.com

Change View.show to call detach if the parentNode dosen't

match before appending to the passed in parent element.
This also prevents appending to the same parent element
multiple times.

Reviewed by John Sullivan.

* page/inspector/FontView.js:
(WebInspector.FontView.prototype.show): Pass the parent element to View.show.
* page/inspector/ResourceView.js: Optimize the attach method to no append if
there is a parentNode already.
* page/inspector/SourceView.js: Ditto.
* page/inspector/View.js: Call detach before appending if the parentNode
doesn't match the passed in element.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1a750fe2
2008-05-13 Timothy Hatcher <timothy@apple.com>
Change View.show to call detach if the parentNode dosen't
match before appending to the passed in parent element.
This also prevents appending to the same parent element
multiple times.
Reviewed by John Sullivan.
* page/inspector/FontView.js:
(WebInspector.FontView.prototype.show): Pass the parent element to View.show.
* page/inspector/ResourceView.js: Optimize the attach method to no append if
there is a parentNode already.
* page/inspector/SourceView.js: Ditto.
* page/inspector/View.js: Call detach before appending if the parentNode
doesn't match the passed in element.
2008-05-13 Timothy Hatcher <timothy@apple.com>
Optimize the panel attach method to no append if there is a
......@@ -45,9 +45,9 @@ WebInspector.FontView = function(resource)
}
WebInspector.FontView.prototype = {
show: function()
show: function(parentElement)
{
WebInspector.ResourceView.prototype.show.call(this);
WebInspector.ResourceView.prototype.show.call(this, parentElement);
this.updateFontPreviewSize();
},
......
......@@ -42,7 +42,8 @@ WebInspector.ResourceView = function(resource)
WebInspector.ResourceView.prototype = {
attach: function()
{
document.getElementById("resource-views").appendChild(this.element);
if (!this.element.parentNode)
document.getElementById("resource-views").appendChild(this.element);
}
}
......
......@@ -42,9 +42,9 @@ WebInspector.SourceView = function(resource)
}
WebInspector.SourceView.prototype = {
show: function()
show: function(parentElement)
{
WebInspector.ResourceView.prototype.show.call(this);
WebInspector.ResourceView.prototype.show.call(this, parentElement);
this.setupSourceFrameIfNeeded();
},
......
......@@ -49,8 +49,10 @@ WebInspector.View.prototype = {
show: function(parentElement)
{
this._visible = true;
if (!this.element.parentNode && parentElement)
if (parentElement && parentElement !== this.element.parentNode) {
this.detach();
parentElement.appendChild(this.element);
}
if (!this.element.parentNode && this.attach)
this.attach();
this.element.addStyleClass("visible");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment