Skip to content

Commit

Permalink
Use normalize-newlines algorithm for setCustomValidity
Browse files Browse the repository at this point in the history
This is for whatwg/html#10350

Differential Revision: https://phabricator.services.mozilla.com/D210688

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1896923
gecko-commit: c9931f28fd168fb6f179eecf28a87a1a738fde0d
gecko-reviewers: emilio
  • Loading branch information
sefeng211 authored and moz-wptsync-bot committed May 18, 2024
1 parent 52079a8 commit cb53e37
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions html/semantics/forms/setCustomValidity-normalize-newlines.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<form>
<input id="email" required>
</form>
<script>
test(function() {
const input = document.getElementById("email");
input.setCustomValidity("First line\rSecond line\r\nThird line\nFourth line");
assert_equals(input.validationMessage, "First line\nSecond line\nThird line\nFourth line");
}, "setCustomValidity should normalize newlines from the given error message");
</script>
</html>

0 comments on commit cb53e37

Please sign in to comment.