WebCore/html/HTMLParser.cpp

15841584
15851585PassRefPtr<Node> HTMLParser::handleIsindex(Token* t)
15861586{
1587  RefPtr<Node> n = new HTMLDivElement(divTag, m_document);
 1587 HTMLFormElement* form = 0;
 1588 RefPtr<Node> n;
15881589
 1590 if (m_currentFormElement)
 1591 n = new HTMLDivElement(divTag, m_document);
 1592 else {
 1593 // Since this <isindex> is not contained within a <form>, we create one.
 1594 form = new HTMLFormElement(formTag, m_document);
 1595 form->setMethod("get");
 1596 if (!m_document->baseURL().isEmpty()) {
 1597 // We treat the href property of the <base> element as the form action, as per section 7.5
 1598 // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>.
 1599 form->setAction(m_document->baseURL().string());
 1600 }
 1601 n = form;
 1602 }
 1603
15891604 NamedMappedAttrMap* attrs = t->attrs.get();
15901605
1591  RefPtr<HTMLIsIndexElement> isIndex = new HTMLIsIndexElement(isindexTag, m_document, m_currentFormElement.get());
 1606 RefPtr<HTMLIsIndexElement> isIndex = new HTMLIsIndexElement(isindexTag, m_document, m_currentFormElement? m_currentFormElement.get() : form);
15921607 isIndex->setAttributeMap(attrs);
15931608 isIndex->setAttribute(typeAttr, "khtml_isindex");
15941609
49810

LayoutTests/http/tests/misc/isindex-with-no-form-base-href.html

 1<html>
 2<head>
 3<script>
 4if (window.layoutTestController) {
 5 layoutTestController.dumpAsText();
 6 layoutTestController.dumpChildFramesAsText();
 7 layoutTestController.waitUntilDone();
 8}
 9</script>
 10</head>
 11<body>
 12<iframe src="resources/isindex-with-no-form-base-href.html"></iframe>
 13</body>
 14</html>
0

LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href.html

 1<html>
 2<head>
 3<base href="http://localhost:8000/misc/resources/isindex-with-no-form-base-href-submit.html">
 4<script>
 5function test()
 6{
 7 var isindexElm = document.getElementById("isindex");
 8 isindexElm.value = "This is a test";
 9 isindexElm.focus();
 10
 11 if (window.eventSender)
 12 eventSender.keyDown(String.fromCharCode(0x0d));
 13}
 14
 15window.onload = test;
 16</script>
 17</head>
 18<body>
 19<p>This page tests that we correctly put the value of an <tt>&lt;isindex&gt;</tt> element into the form data.</p>
 20<p>If you are running this test by hand, submit the phrase: &quot;This is a test&quot; (without quotes).</p>
 21<isindex id="isindex"></isindex>
 22</body>
 23</html>
0

LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href-submit.html

 1<html>
 2<head>
 3<script>
 4function test()
 5{
 6 var expected = "?This+is+a+test";
 7 if (location.search != expected)
 8 log("FAIL: Expected \"" + expected + "\" but got \"" + location.search + "\"");
 9 else
 10 log("PASS");
 11}
 12
 13function log(msg)
 14{
 15 document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
 16}
 17
 18window.onload = test;
 19</script>
 20</head>
 21<body>
 22<pre id="log"></pre>
 23<script>
 24if (window.layoutTestController)
 25 layoutTestController.notifyDone();
 26</script>
 27</body>
 28</html>
0

LayoutTests/http/tests/misc/isindex-with-no-form-expected.txt

 1This page tests that we correctly put the value of an <isindex> element into the form data.
 2
 3If you are running this test by hand, submit the phrase: "This is a test" (without quotes).
 4
 5This is a searchable index. Enter search keywords:
 6PASS
 7
0

LayoutTests/http/tests/misc/isindex-with-no-form.html

 1<html>
 2<head>
 3<script>
 4function test()
 5{
 6 var isindexElm = document.getElementById("isindex");
 7 if (!location.search.length) {
 8 if (window.layoutTestController) {
 9 layoutTestController.dumpAsText();
 10 layoutTestController.waitUntilDone();
 11 }
 12
 13 isindexElm.value = "This is a test";
 14 isindexElm.focus();
 15
 16 if (window.eventSender)
 17 eventSender.keyDown(String.fromCharCode(0x0d));
 18 } else {
 19 var expected = "?This+is+a+test";
 20 if (location.search != expected)
 21 log("FAIL: Expected \"" + expected + "\" but got \"" + location.search + "\"");
 22 else
 23 log("PASS");
 24
 25 if (window.layoutTestController)
 26 layoutTestController.notifyDone();
 27 }
 28}
 29
 30function log(msg)
 31{
 32 document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
 33}
 34
 35window.onload = test;
 36</script>
 37</head>
 38<body>
 39<p>This page tests that we correctly put the value of an <tt>&lt;isindex&gt;</tt> element into the form data.</p>
 40<p>If you are running this test by hand, submit the phrase: &quot;This is a test&quot; (without quotes).</p>
 41<isindex id="isindex"></isindex>
 42<pre id="log"></pre>
 43</body>
 44</html>
0

LayoutTests/http/tests/misc/isindex-with-no-form-base-href-expected.txt

 1
 2
 3--------
 4Frame: '<!--framePath //<!--frame0-->-->'
 5--------
 6PASS
 7
0