Search code examples
mootoolsgoogle-chrome-devtools

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


Since upgrading to Chrome 41.0.2272.89 m, Mootools Core 1.5.1 is throwing a warning. Nothing major, but if you are as retentive as I am, it may irk you a little.

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){}

Throws warning:

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


Solution

  • To fix, change the try catch above to:

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

    Or in the compressed version , search for "email" and change this:

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

    To:

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