html格式自动输入内容吗,html5 – Chrome自动格式输入=数字

这是因为与Chromium中的HTML5号码输入类型相关联的行为,您肯定是

not the only one不关心这一点。

我已经通过使用文本类型过去解决了这个问题。例如,这已经很好(刚刚在Chrome 11.0.696.71中测试):

placeholder="Enter Text"

name="inputName"

pattern="[0-9]*">

这种数字类型的行为(对我来说,至少)肯定是一个bug,因为HTML5 standard指定的数字应该具有以下值格式化显示时:

The algorithm to convert a number to a string,given a number input,is as follows: Return a valid floating point number that represents input.

而标准定义了一个“有效的浮点”数字here,就我所见,包括分组字符是不期望的。

更新

我已经孤立的问题到下面的代码在WebKit的胆量。我已经包括修复这里问题的线:

// From LocalizedNumberICU.cpp

String formatLocalizedNumber(double number,unsigned fractionDigits)

{

NumberFormat* formatter = numberFormatter();

if (!formatter)

return String();

UnicodeString result;

formatter->setMaximumFractionDigits(clampToInteger(fractionDigits));

formatter->setGroupingUsed(FALSE); // added this line to fix the problem

formatter->format(number,result);

return String(result.getBuffer(),result.length());

}

我下周度假,但计划在我返回时将此补丁提交给WebKit团队。一旦他们(希望)接受补丁,Chromium应该把它作为正常刷新过程的一部分。

You can see the original code 07003,the patched revision 07004,and the diff of the original file and the patched file 07005. The final patch was created by Shinya Kawanaka.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值