mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900724 - Prevent form association when creating elements in template contents. r=hsivonen
This commit is contained in:
parent
b0e155cb0a
commit
3c3062971a
@ -11,6 +11,7 @@ relativesrcdir = @relativesrcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
test_bug900724.html \
|
||||
test_document_register.html \
|
||||
test_document_register_lifecycle.html \
|
||||
test_template.html \
|
||||
|
32
dom/tests/mochitest/webcomponents/test_bug900724.html
Normal file
32
dom/tests/mochitest/webcomponents/test_bug900724.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=900724
|
||||
-->
|
||||
<head>
|
||||
<title>Test for form-association in template contents.</title>
|
||||
<script type="text/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=900724">Bug 900724</a>
|
||||
<form id="formone"><template id="templateone"><input></template></form>
|
||||
<form id="formthree"><template id="templatethree"></template></form>
|
||||
<form id="formfive"><template id="templatefive"></template></form>
|
||||
<script>
|
||||
is($("formone").elements.length, 0, "Forms should have no association with controls in template contents.");
|
||||
|
||||
var templateOneInput = $("templateone").content.firstChild;
|
||||
is(templateOneInput.form, null, "Form controls inside template contents should not associate with forms.");
|
||||
|
||||
// Try dynamically adding form/form controls using innerHTML.
|
||||
$("templatethree").innerHTML = '<input>';
|
||||
is($("formthree").elements.length, 0, "Form controls inside template contents should not associate with forms.");
|
||||
|
||||
// Append a form control as a child of the template (not template contents) and make sure form is associated.
|
||||
var formFiveInput = document.createElement("input");
|
||||
$("templatefive").appendChild(formFiveInput);
|
||||
is($("formfive").elements.length, 1, "Form control should associate with form control not in template contents.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -5231,8 +5231,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||
checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
|
||||
// ]NOCPP]
|
||||
// Can't be called for custom elements
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes, fragment ? null
|
||||
: form);
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes,
|
||||
form == null || fragment || isTemplateContents() ? null : form);
|
||||
StackNode<T> current = stack[currentPtr];
|
||||
if (current.isFosterParenting()) {
|
||||
fatal();
|
||||
@ -5254,7 +5254,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||
checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
|
||||
// ]NOCPP]
|
||||
// Can't be called for custom elements
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", name, attributes, fragment ? null : form);
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", name, attributes,
|
||||
form == null || fragment || isTemplateContents() ? null : form);
|
||||
StackNode<T> current = stack[currentPtr];
|
||||
if (current.isFosterParenting()) {
|
||||
fatal();
|
||||
@ -5338,7 +5339,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||
checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
|
||||
// ]NOCPP]
|
||||
// Can't be called for custom elements
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", name, attributes, fragment ? null : form);
|
||||
T elt = createElement("http://www.w3.org/1999/xhtml", name, attributes,
|
||||
form == null || fragment || isTemplateContents() ? null : form);
|
||||
StackNode<T> current = stack[currentPtr];
|
||||
appendElement(elt, current.node);
|
||||
elementPushed("http://www.w3.org/1999/xhtml", name, elt);
|
||||
|
@ -3944,7 +3944,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5Element
|
||||
void
|
||||
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContent** form)
|
||||
{
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, fragment ? nullptr : form);
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
|
||||
nsHtml5StackNode* current = stack[currentPtr];
|
||||
if (current->isFosterParenting()) {
|
||||
|
||||
@ -3959,7 +3959,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
|
||||
void
|
||||
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form)
|
||||
{
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, fragment ? nullptr : form);
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
|
||||
nsHtml5StackNode* current = stack[currentPtr];
|
||||
if (current->isFosterParenting()) {
|
||||
|
||||
@ -4022,7 +4022,7 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName
|
||||
void
|
||||
nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form)
|
||||
{
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, fragment ? nullptr : form);
|
||||
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
|
||||
nsHtml5StackNode* current = stack[currentPtr];
|
||||
appendElement(elt, current->node);
|
||||
elementPushed(kNameSpaceID_XHTML, name, elt);
|
||||
|
Loading…
Reference in New Issue
Block a user