зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513890 - Get rid of x-moz-errormessage attribute, r=edgar
This commit is contained in:
Родитель
f7e7d64686
Коммит
c7a7810165
|
@ -355,27 +355,6 @@ add_task(async function() {
|
|||
gBrowser.removeTab(gBrowser.getTabForBrowser(browser));
|
||||
});
|
||||
|
||||
/**
|
||||
* In this test, we check that the author defined error message is shown.
|
||||
*/
|
||||
add_task(async function() {
|
||||
incrementTest();
|
||||
let uri = getDocHeader() + "<form target='t' action='data:text/html,'><input x-moz-errormessage='foo' required id='i'><input id='s' type='submit'></form>" + getDocFooter();
|
||||
let browser = await openNewTab(uri);
|
||||
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(gInvalidFormPopup, "popupshown");
|
||||
await clickChildElement(browser);
|
||||
await popupShownPromise;
|
||||
|
||||
checkPopupShow();
|
||||
await checkChildFocus(browser, gInvalidFormPopup.firstElementChild.textContent);
|
||||
|
||||
is(gInvalidFormPopup.firstElementChild.textContent, "foo",
|
||||
"The panel should show the author defined error message");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
/**
|
||||
* In this test, we check that the message is correctly updated when it changes.
|
||||
*/
|
||||
|
|
|
@ -46,20 +46,7 @@ void nsIConstraintValidation::GetValidationMessage(
|
|||
aValidationMessage.Truncate();
|
||||
|
||||
if (IsCandidateForConstraintValidation() && !IsValid()) {
|
||||
nsCOMPtr<Element> element = do_QueryInterface(this);
|
||||
NS_ASSERTION(element,
|
||||
"This class should be inherited by HTML elements only!");
|
||||
|
||||
nsAutoString authorMessage;
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::x_moz_errormessage,
|
||||
authorMessage);
|
||||
|
||||
if (!authorMessage.IsEmpty()) {
|
||||
aValidationMessage.Assign(authorMessage);
|
||||
if (aValidationMessage.Length() > sContentSpecifiedMaxLengthMessage) {
|
||||
aValidationMessage.Truncate(sContentSpecifiedMaxLengthMessage);
|
||||
}
|
||||
} else if (GetValidityState(VALIDITY_STATE_CUSTOM_ERROR)) {
|
||||
if (GetValidityState(VALIDITY_STATE_CUSTOM_ERROR)) {
|
||||
aValidationMessage.Assign(mCustomValidity);
|
||||
if (aValidationMessage.Length() > sContentSpecifiedMaxLengthMessage) {
|
||||
aValidationMessage.Truncate(sContentSpecifiedMaxLengthMessage);
|
||||
|
|
|
@ -24,7 +24,7 @@ var content = document.getElementById('content');
|
|||
for (var eName of subjectForConstraintValidation) {
|
||||
var e = document.createElement(eName);
|
||||
content.appendChild(e);
|
||||
e.setAttribute("x-moz-errormessage", "foo");
|
||||
e.setCustomValidity("foo");
|
||||
if ("required" in e) {
|
||||
e.required = true;
|
||||
} else {
|
||||
|
|
|
@ -39,13 +39,8 @@ for (var i=0; i<75; ++i) {
|
|||
input.setCustomValidity(msg);
|
||||
checkMessage(input, msg, false);
|
||||
|
||||
// The input is still invalid but x-moz-errormessage will be used as the message.
|
||||
input.setAttribute("x-moz-errormessage", msg);
|
||||
checkMessage(input, msg, false);
|
||||
|
||||
// Cleaning.
|
||||
input.setCustomValidity("");
|
||||
input.removeAttribute("x-moz-errormessage");
|
||||
|
||||
// Testing with pattern and titl.
|
||||
input.pattern = "[0-9]*";
|
||||
|
|
|
@ -671,7 +671,6 @@ STATIC_ATOMS = [
|
|||
Atom("mozTableRemoveColumn", "mozTableRemoveColumn"),
|
||||
Atom("moz_opaque", "moz-opaque"),
|
||||
Atom("moz_action_hint", "mozactionhint"),
|
||||
Atom("x_moz_errormessage", "x-moz-errormessage"),
|
||||
Atom("multicol", "multicol"),
|
||||
Atom("multiple", "multiple"),
|
||||
Atom("muted", "muted"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче