输入元素(用于iOS)上的Autocapitalize属性会中断验证 [英] Autocapitalize attribute on input element (used for iOS) breaks validation

查看:289
本文介绍了输入元素(用于iOS)上的Autocapitalize属性会中断验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以看到此处,适用于iPhone的Safari和Safari支持所有HTML元素,包括不推荐使用的元素,甚至是一些永远不属于任何W3C规范的专有元素。

As can be seen here, Safari and Safari for the iPhone support all HTML elements, including deprecated elements and even some proprietary elements that were never part of any W3C specifications.

它实际上非常有用,包括 autocapitalize 在表单中的电子邮件和网站字段中,因为在填写这两个输入中的任何一个时必须取消选择SHIFT键没有什么比这更令人讨厌的了。这样做是微不足道的,因为您需要做的就是将 autocapitalize = off 属性添加到相应的输入中,例如:

It's actually very useful including autocapitalize in the 'email' and 'website' fields in forms, as there's nothing so annoying as having to unselect the SHIFT key when filling in either of those two inputs. Doing this is trivial as all you need to do is add the autocapitalize=off attribute to the corresponding input, e.g.:

<label for="email">E-mail</label>
<input type="email" name="email" placeholder="yourname@domain.com" autocapitalize="off" title="Enter your e-mail address" class="required email" id="email">

iPhone和iPad都完美地将键盘与表格中输入元素附加的属性相匹配。不幸的是,这个标记似乎打破了验证,当上面的设置时,W3C响应此时元素输入上不允许属性自动资本化。

Both the iPhone and the iPad perfectly match keyboards to the attributes attached to the input element in forms. Unfortunately, this markup seems to break validation, with W3C responding with 'Attribute autocapitalize not allowed on element input at this point' when the above is set.

我想这不是有什么东西要死,但有没有办法在不破坏验证的情况下包含属性?也许我在这里遇到了什么问题。

I suppose this isn't something to die for, but is there a way of including the attributes without breaking validation? Maybe I've got something wrong here.

推荐答案

ughoavgfhw的评论完全回答了这个问题:正如W3C规范目前所说的那样,您不能在不破坏验证的情况下在表单中包含autocapitalize属性,因此,如果用户不得不在表单中摸索 SHIFT ,那么就会造成不便。 iOS上的密钥。

The comment by ughoavgfhw fully answers the question: as W3C specs stand at present, you can't include the autocapitalize attribute in your forms without breaking validation, so it's a case of weighing that inconvenience against that of users having to fumble through your forms clicking on the SHIFTkey on iOS.

我认为这是极少数情况之一(内联样式是另一种情况),只要在一个页面上存在错误就有意义了,只要他们并没有出现任何问题,只是W3C在采用方面有点慢。

I think this is one of those rare cases (inline styles being another) where it makes sense to put up with errors on one page, so long as they aren't symptomatic of anything gone wrong but just of W3C being a bit slow on the uptake.

这篇关于输入元素(用于iOS)上的Autocapitalize属性会中断验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆