Fixed not allowing '-' and '+' for font tag 'size' attribute in Advanced Edit dialog, b=88878, r=akkana, sr=shaver, a=asa

This commit is contained in:
cmanske%netscape.com 2001-09-01 14:14:36 +00:00
parent 8494402fec
commit 71d9088f0b
2 changed files with 13 additions and 2 deletions

View File

@ -123,6 +123,7 @@ var gVAlignTable =
are signal to do input filtering:
"#" Allow only integer values
"%" Allow integer values or a number ending in "%"
"+" Allow integer values and allow "+" or "-" as first character
"!" Allow only one character
"^" The first character can be only be A-Z, a-z, hyphen, underscore, colon or period
"$" is an attribute required by HTML DTD
@ -616,7 +617,7 @@ gHTMLAttr.fieldset =
// this is deprecated //
gHTMLAttr.font =
[
"#size",
"+size",
"color",
"face",
"-",

View File

@ -72,12 +72,13 @@ function BuildHTMLAttributeNameList()
// Get information about value filtering
var forceOneChar = name.indexOf("!") >= 0;
var forceInteger = name.indexOf("#") >= 0;
var forceSignedInteger = name.indexOf("+") >= 0;
var forceIntOrPercent = name.indexOf("%") >= 0;
limitFirstChar = name.indexOf("\^") >= 0;
//var required = name.indexOf("$") >= 0;
// Strip flag characters ("_" is used when attribute name is reserved JS word)
name = name.replace(/[!^#%$_]/g, "");
name = name.replace(/[!^#%$_+]/g, "");
menuitem = AppendStringToMenulist(dialog.AddHTMLAttributeNameInput, name);
if (menuitem)
@ -92,6 +93,7 @@ function BuildHTMLAttributeNameList()
menuitem.setAttribute("forceOneChar", forceOneChar ? "true" : "");
menuitem.setAttribute("limitFirstChar", limitFirstChar ? "true" : "");
menuitem.setAttribute("forceInteger", forceInteger ? "true" : "");
menuitem.setAttribute("forceSignedInteger", forceSignedInteger ? "true" : "");
menuitem.setAttribute("forceIntOrPercent", forceIntOrPercent ? "true" : "");
}
}
@ -300,6 +302,14 @@ function onInputHTMLAttributeValue()
{
value = value.replace(/\D+/g,"");
}
else if ( selectedItem.getAttribute("forceSignedInteger") == "true" )
{
// Allow integer with optional "+" or "-" as first character
var sign = value[0];
value = value.replace(/\D+/g,"");
if (sign == "+" || sign == "-")
value = sign + value;
}
// Special case attributes
if (selectedItem.getAttribute("limitFirstChar") == "true")