mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 399653 - "Insert Node dialog can't create HTML elements" [p=taken.spc@gmail.com (KUROSAWA, Takeshi) r=db48x sr=Neil]
This commit is contained in:
parent
b5d11f686b
commit
19af3d1d23
@ -1365,23 +1365,27 @@ InsertNode.prototype =
|
||||
{
|
||||
var doc = this.originalNode.ownerDocument;
|
||||
if (!this.attr) {
|
||||
this.attr = { type: null, value: null, namespaceURI: null, accepted: false };
|
||||
this.attr = { type: null, value: null, namespaceURI: null, accepted: false,
|
||||
enableNamespaces: doc.contentType != "text/html" };
|
||||
|
||||
window.openDialog("chrome://inspector/content/viewers/dom/insertDialog.xul",
|
||||
"insert", "chrome,modal,centerscreen", doc, this.attr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (this.attr.accepted) {
|
||||
switch (this.attr.type) {
|
||||
switch (this.attr.type) {
|
||||
case nsIDOMNode.ELEMENT_NODE:
|
||||
this.insertedNode = doc.createElementNS(this.attr.namespaceURI, this.attr.value);
|
||||
break;
|
||||
case nsIDOMNode.TEXT_NODE:
|
||||
this.insertedNode = doc.createTextNode(this.attr.value);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
if (this.attr.enableNamespaces)
|
||||
this.insertedNode = doc.createElementNS(this.attr.namespaceURI, this.attr.value);
|
||||
else
|
||||
this.insertedNode = doc.createElement(this.attr.value);
|
||||
break;
|
||||
case nsIDOMNode.TEXT_NODE:
|
||||
this.insertedNode = doc.createTextNode(this.attr.value);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ InsertDialog.prototype =
|
||||
var customNS = document.getElementById("mi_custom");
|
||||
var accept = document.documentElement.getButton("accept");
|
||||
|
||||
this.menulist.disabled = !this.enableNamespaces();
|
||||
this.menulist.disabled = !this.mData.enableNamespaces;
|
||||
defaultNS.value = this.mDoc.documentElement.namespaceURI;
|
||||
|
||||
this.toggleNamespace();
|
||||
@ -135,17 +135,6 @@ InsertDialog.prototype =
|
||||
dialog.namespace.value = dialog.menulist.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* enableNamespaces determines if the document accepts namespaces or not
|
||||
*
|
||||
* @return True if the document can have namespaced attributes, false
|
||||
* otherwise.
|
||||
*/
|
||||
enableNamespaces: function enableNamespaces()
|
||||
{
|
||||
return this.mDoc.contentType != "text/html";
|
||||
},
|
||||
|
||||
/**
|
||||
* toggleAccept enables/disables the Accept button when there is/isn't an
|
||||
* attribute name.
|
||||
|
Loading…
Reference in New Issue
Block a user