modernizr.custom.input-types-and-atts.js 3.56 KB
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-input-inputtypes
 *//* Modernizr 2.6.2 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-input-inputtypes
 */
window.Modernizr = function(a, b, c) {
    function u(a) {
        i.cssText = a
    }

    function v(a, b) {
        return u(prefixes.join(a + ";") + (b || ""))
    }

    function w(a, b) {
        return typeof a === b
    }

    function x(a, b) {
        return !!~("" + a).indexOf(b)
    }

    function y(a, b, d) {
        for (var e in a) {
            var f = b[a[e]];
            if (f !== c) return d === !1 ? a[e] : w(f, "function") ? f.bind(d || b) : f
        }
        return !1
    }

    function z() {
        e.input = function(c) {
            for (var d = 0, e = c.length; d < e; d++) o[c[d]] = c[d] in j;
            return o.list && (o.list = !!b.createElement("datalist") && !!a.HTMLDataListElement), o
        }("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")), e.inputtypes = function(a) {
            for (var d = 0, e, g, h, i = a.length; d < i; d++) j.setAttribute("type", g = a[d]), e = j.type !== "text", e && (j.value = k, j.style.cssText = "position:absolute;visibility:hidden;", /^range$/.test(g) && j.style.WebkitAppearance !== c ? (f.appendChild(j), h = b.defaultView, e = h.getComputedStyle && h.getComputedStyle(j, null).WebkitAppearance !== "textfield" && j.offsetHeight !== 0, f.removeChild(j)) : /^(search|tel)$/.test(g) || (/^(url|email)$/.test(g) ? e = j.checkValidity && j.checkValidity() === !1 : e = j.value != k)), n[a[d]] = !!e;
            return n
        }("search tel url email datetime date month week time datetime-local number range color".split(" "))
    }
    var d = "2.6.2",
        e = {},
        f = b.documentElement,
        g = "modernizr",
        h = b.createElement(g),
        i = h.style,
        j = b.createElement("input"),
        k = ":)",
        l = {}.toString,
        m = {},
        n = {},
        o = {},
        p = [],
        q = p.slice,
        r, s = {}.hasOwnProperty,
        t;
    !w(s, "undefined") && !w(s.call, "undefined") ? t = function(a, b) {
        return s.call(a, b)
    } : t = function(a, b) {
        return b in a && w(a.constructor.prototype[b], "undefined")
    }, Function.prototype.bind || (Function.prototype.bind = function(b) {
        var c = this;
        if (typeof c != "function") throw new TypeError;
        var d = q.call(arguments, 1),
            e = function() {
                if (this instanceof e) {
                    var a = function() {};
                    a.prototype = c.prototype;
                    var f = new a,
                        g = c.apply(f, d.concat(q.call(arguments)));
                    return Object(g) === g ? g : f
                }
                return c.apply(b, d.concat(q.call(arguments)))
            };
        return e
    });
    for (var A in m) t(m, A) && (r = A.toLowerCase(), e[r] = m[A](), p.push((e[r] ? "" : "no-") + r));
    return e.input || z(), e.addTest = function(a, b) {
        if (typeof a == "object")
            for (var d in a) t(a, d) && e.addTest(d, a[d]);
        else {
            a = a.toLowerCase();
            if (e[a] !== c) return e;
            b = typeof b == "function" ? b() : b, typeof enableClasses != "undefined" && enableClasses && (f.className += " " + (b ? "" : "no-") + a), e[a] = b
        }
        return e
    }, u(""), h = j = null, e._version = d, e
}(this, this.document);