[whatwg] pattern='' should be ignored

Mounir Lamouri mounir.lamouri at gmail.com
Wed Jul 28 03:41:59 PDT 2010


Hi,

At the moment, to suffer from a pattern mismatch an element needs a
non-empty value and a specified pattern (and the pattern should not
match the entire value) [1]. So, if, for any reason, an author write
<input pattern=''>, the element would be always suffering from a pattern
mismatch except when value=''.
I do not imagine an author would like to make its element always invalid
and even if it is, I think most people will try to write pattern='' to
reset the pattern.
If someone wants to make the element invalid when the value is not
empty, he/she can use setCustomValidity or even have a pattern that is
not empty but can't match the value (like '[]').

So, to prevent any undesirable behavior with this edge case, I propose
to change:
[[
If the element's value is not the empty string, and the element's
pattern  attribute is specified and the attribute's value, when [..]
]]
to:
[[
If the element's value and the element's pattern attribute are not the
empty string and the attribute's value, when [..]
]]

[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-pattern-attribute

Thanks,
--
Mounir



More information about the whatwg mailing list