зеркало из https://github.com/mozilla/pjs.git
bug 226752 and bug 220833 - 'Page info' dialog shows form fields belonging to incorrect forms; view page info/forms shows id, not name attribute
r=jag, sr=bz
This commit is contained in:
Родитель
38d4de896a
Коммит
fa324538de
|
@ -603,14 +603,12 @@ function onFormSelect()
|
||||||
var ft = null;
|
var ft = null;
|
||||||
if (form.name)
|
if (form.name)
|
||||||
ft = theBundle.getFormattedString("formTitle", [form.name]);
|
ft = theBundle.getFormattedString("formTitle", [form.name]);
|
||||||
else
|
|
||||||
ft = theBundle.getString("formUntitled");
|
|
||||||
|
|
||||||
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
|
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
|
||||||
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
|
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
|
||||||
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
|
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
|
||||||
|
|
||||||
var formfields = findFormControls(form);
|
var formfields = form.elements;
|
||||||
|
|
||||||
var length = formfields.length;
|
var length = formfields.length;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
@ -627,7 +625,7 @@ function onFormSelect()
|
||||||
else
|
else
|
||||||
val = (/^password$/i.test(elem.type)) ? theBundle.getString("formPassword") : elem.value;
|
val = (/^password$/i.test(elem.type)) ? theBundle.getString("formPassword") : elem.value;
|
||||||
|
|
||||||
fieldView.addRow(["", elem.id || elem.name, elem.type, val]);
|
fieldView.addRow(["", elem.name, elem.type, val]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var labels = form.getElementsByTagName("label");
|
var labels = form.getElementsByTagName("label");
|
||||||
|
@ -670,17 +668,6 @@ function findFirstControl(node)
|
||||||
return iterator.nextNode();
|
return iterator.nextNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
function findFormControls(node)
|
|
||||||
{
|
|
||||||
var iterator = theDocument.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, FormControlFilter, true);
|
|
||||||
|
|
||||||
var list = [];
|
|
||||||
while (iterator.nextNode())
|
|
||||||
list.push(iterator.currentNode);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//******** Link Stuff
|
//******** Link Stuff
|
||||||
function openURL(target)
|
function openURL(target)
|
||||||
{
|
{
|
||||||
|
|
|
@ -613,14 +613,12 @@ function onFormSelect()
|
||||||
var ft = null;
|
var ft = null;
|
||||||
if (form.name)
|
if (form.name)
|
||||||
ft = theBundle.getFormattedString("formTitle", [form.name]);
|
ft = theBundle.getFormattedString("formTitle", [form.name]);
|
||||||
else
|
|
||||||
ft = theBundle.getString("formUntitled");
|
|
||||||
|
|
||||||
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
|
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
|
||||||
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
|
document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");
|
||||||
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
|
document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");
|
||||||
|
|
||||||
var formfields = findFormControls(form);
|
var formfields = form.elements;
|
||||||
|
|
||||||
var length = formfields.length;
|
var length = formfields.length;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
@ -637,7 +635,7 @@ function onFormSelect()
|
||||||
else
|
else
|
||||||
val = (/^password$/i.test(elem.type)) ? theBundle.getString("formPassword") : elem.value;
|
val = (/^password$/i.test(elem.type)) ? theBundle.getString("formPassword") : elem.value;
|
||||||
|
|
||||||
fieldView.addRow(["", elem.id || elem.name, elem.type, val]);
|
fieldView.addRow(["", elem.name, elem.type, val]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var labels = form.getElementsByTagName("label");
|
var labels = form.getElementsByTagName("label");
|
||||||
|
@ -678,17 +676,6 @@ function findFirstControl(node)
|
||||||
return iterator.nextNode();
|
return iterator.nextNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
function findFormControls(node)
|
|
||||||
{
|
|
||||||
var iterator = theDocument.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, FormControlFilter, true);
|
|
||||||
|
|
||||||
var list = [];
|
|
||||||
while (iterator.nextNode())
|
|
||||||
list.push(iterator.currentNode);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//******** Link Stuff
|
//******** Link Stuff
|
||||||
function openURL(target)
|
function openURL(target)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче