Don't trim whitespace off hidden input values. Bug 114997, patch by Steuard

Jensen <steuard+moz@slimy.com>, r=sicking, sr=bzbarsky


git-svn-id: svn://10.0.0.236/trunk@194535 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-04-17 21:28:47 +00:00
parent 88cf59bbf0
commit 0b800bdc50
2 changed files with 17 additions and 1 deletions

View File

@@ -839,8 +839,15 @@ HTMLContentSink::AddAttributes(const nsIParserNode& aNode,
// Get value and remove mandatory quotes
static const char* kWhitespace = "\n\r\t\b";
// Bug 114997: Don't trim whitespace on <input value="...">:
// Using ?: outside the function call would be more efficient, but
// we don't trust ?: with references.
const nsAString& v =
nsContentUtils::TrimCharsInSet(kWhitespace, aNode.GetValueAt(i));
nsContentUtils::TrimCharsInSet(
(nodeType == eHTMLTag_input &&
keyAtom == nsHTMLAtoms::value) ?
"" : kWhitespace, aNode.GetValueAt(i));
if (nodeType == eHTMLTag_a && keyAtom == nsHTMLAtoms::name) {
NS_ConvertUTF16toUTF8 cname(v);