Permalink
Browse files

Merge branch 'master' of https://github.com/firebug/firebug.git

  • Loading branch information...
2 parents a878a5f + d3e4858 commit 4b6aefec5f7ee7ef9725112f9a891600547f8487 @SebastianZ SebastianZ committed May 31, 2012
Showing with 10 additions and 5 deletions.
  1. +10 −5 extension/content/firebug/html/htmlPanel.js
@@ -174,6 +174,12 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
this.selection = object;
this.updateSelection(object);
+ // The Edit button (in the toolbar) must be updated every time the selection
+ // changes. Some elements (such as <html>) can't be edited.
+ var edit = Firebug.chrome.$("fbToggleHTMLEditing");
+ edit.disabled = object ? Css.nonEditableTags.hasOwnProperty(object.localName) : false;
+
+ // Distribute selection change further to listeners.
Events.dispatch(Firebug.uiListeners, "onObjectSelected", [object, this]);
// If the 'free text' edit mode is active change the current markup
@@ -688,8 +694,9 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
{
// If the editing mode is currently active, remembe the target mutation.
// The mutation is coming from user changes and will be selected as soon
- // as the editing mode is finished.
- if (this.isEditing())
+ // as the editing mode is finished. Only HTMLElement can be selected
+ // (not a simple text node)
+ if (this.isEditing() && (target instanceof window.HTMLElement))
this.nextSelection = target;
}
@@ -1096,10 +1103,8 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
this.noScrollIntoView = true;
this.select(node);
- Firebug.chrome.$('fbToggleHTMLEditing').disabled =
- Css.nonEditableTags.hasOwnProperty(node.localName);
-
delete this.noScrollIntoView;
+
if (Css.hasClass(event.target, "twisty"))
this.toggleNode(event);
}

0 comments on commit 4b6aefe

Please sign in to comment.