Index: third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
index 8385afdaf36d9d929e0c51b152c7117040b9b137..be254a2cb65d4f99371dd09284d5f0852b89e06b 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
@@ -291,6 +291,26 @@ void HTMLFormElement::prepareForSubmission( |
return; |
} |
+ // https://github.com/whatwg/html/issues/2253 |
+ for (const auto& element : listedElements()) { |
+ if (element->isFormControlElement() && |
+ toHTMLFormControlElement(element)->blocksFormSubmission()) { |
+ UseCounter::count(document(), |
+ UseCounter::FormSubmittedWithUnclosedFormControl); |
+ if (RuntimeEnabledFeatures::unclosedFormControlIsInvalidEnabled()) { |
+ String tagName = toHTMLFormControlElement(element)->tagName(); |
+ document().addConsoleMessage(ConsoleMessage::create( |
+ SecurityMessageSource, ErrorMessageLevel, |
+ "Form submission failed, as the <" + tagName + "> element named " |
+ "'" + element->name() + "' was implicitly closed by reaching " |
+ "the end of the file. Please add an explicit end tag " |
+ "('</" + tagName + ">')")); |
+ dispatchEvent(Event::create(EventTypeNames::error)); |
+ return; |
+ } |
+ } |
+ } |
+ |
bool skipValidation = !document().page() || noValidate(); |
DCHECK(event); |
if (submitButton && submitButton->formNoValidate()) |