Bug 340017. Make document.formName work in XHTML. r=bzbarsky

This commit is contained in:
Saint Wesonga 2009-12-11 22:36:33 -08:00
parent 73f9a129d8
commit e0f8a87194
3 changed files with 29 additions and 5 deletions

View File

@ -2635,11 +2635,6 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
{
*aResult = nsnull;
if (!mIsRegularHTML) {
// We don't dynamically resolve names on non-HTML documents.
return NS_OK;
}
nsCOMPtr<nsIAtom> name(do_GetAtom(aName));
// We have built a table and cache the named items. The table will

View File

@ -97,6 +97,7 @@ _TEST_FILES = test_bug1682.html \
test_bug486741.html \
test_bug497242.xhtml \
test_bug512367.html \
test_bug340017.xhtml \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,28 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=340017
-->
<head>
<title>Test for Bug 340017</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=340017">Mozilla Bug 340017</a>
<p id="display"></p>
<div id="content" style="display: none">
<form id="frmfoo" name="foo" action="" />
</div>
<pre id="test">
<script type="application/javascript">
<![CDATA[
/** Test for Bug 340017 **/
is(document.foo, document.getElementById("frmfoo"),
"The form with name 'foo' should be a document accessible property");
]]>
</script>
</pre>
</body>
</html>