validate icon indicating copy to clipboard operation
validate copied to clipboard

Restore customError property in the ValidityState() polyfill

Open michapietsch opened this issue 7 years ago • 4 comments
trafficstars

Hi,

I was missing the customError property when working with setCustomValidity(). I think we can safely assume that a custom error was set when validationMessage contains a message but all the other checks don't qualify.

Regards, Micha

michapietsch avatar Apr 06 '18 15:04 michapietsch

Sorry for being dense, but can you tell me what this PR does? Been a little while since I looked at the code on this. Thanks!

cferdinandi avatar Apr 08 '18 03:04 cferdinandi

Sure, you're welcome! The Constraint API allows to setCustomValidity() to give a custom error message, e.g. "Username already taken" or you can pass an empty string to remove the custom error. This is nice to Integrate additional requirements but still use the Constraint API. The presence of such a custom error is then represented by a property customError: true inside the validityState object. When using the polyfill before this PR, this behavior was overwritten and therefore removed.

michapietsch avatar Apr 08 '18 11:04 michapietsch

Sorry, I clicked the wrong button 🙈

michapietsch avatar Apr 08 '18 11:04 michapietsch

Makes sense, thanks! And I do that ALL the time. No worries! I'll get this merged soon.

cferdinandi avatar Apr 12 '18 04:04 cferdinandi