Core 1.5.1 在更新到最新版本后对 IE 输入类型电子邮件检查抛出警告 chrome

Core 1.5.1 Throws Warning on IE Input type email check after updating to latest chrome

自从升级到 Chrome 41.0.2272.89 m,Mootools Core 1.5.1 发出警告。没什么大不了的,但如果你像我一样有记忆力,可能会让你有点厌烦。

var input = document.createElement('input'), volatileInputValue, html5InputSupport;

// #2178
input.value = 't';
input.type = 'submit';
volatileInputValue = input.value != 't';

// #2443 - IE throws "Invalid Argument" when trying to use html5 input types
try {
    input.type = 'email';
    html5InputSupport = input.type == 'email';
} catch(e){}

抛出警告:

The specified value 't' is not a valid email address.

要修复,请将上面的 try catch 更改为:

try {
    input.value = '';
    input.type = 'email';
    html5InputSupport = input.type == 'email';
} catch(e){}

或在压缩版中,搜索"email"并更改为:

try{p.type="email",h="email"==p.type}catch(c){}

收件人:

try{p.value="",p.type="email",h="email"==p.type}catch(c){}