aFarkas / webshim

[DEPRECATED] Webshims Lib is a modular capability-based polyfill-loading library
http://aFarkas.github.com/webshim/demos/index.html
MIT License
1.42k stars 201 forks source link

forms-ext limited to "types: 'number'" but is still polyfilling date inputs in Chrome #572

Open chrisdunnbirch opened 8 years ago

chrisdunnbirch commented 8 years ago

I'm currently having a strange issue whereby telling 'forms-ext' which types to polyfills appears to only be understood in Firefox.

I have a page with an <input type="date"> element which is being replaced with a jQueryUI Datepicker, obviously the input itself is hidden and the jQueryUI Datepicker elements are styled and visible.

I've tested this page in Safari, Opera, Chrome, Firefox and IE across OS X El Capitan and Windows 7 & 10. Firefox appears as desired, with the <input type="date"> element being ignored by webshim as per the code below. However all other browsers show a webshim <input type="text"> with associated webshim datepicker <span class="input-buttons date-input-buttons">. I'm really struggling to figure out whether this is something I've done incorrectly with the webshim configuration or whether this is a bug with webshim itself.

Here is an image of the result on Gyazo.

Below is the code, as you can see I only want forms-ext to polyfill <input type="number">:

webshim.setOptions({
    'debug': true,
    'forms': {
        replaceValidationUI: true,
        lazyCustomMessages: true,
        iVal: {
            fieldWrapper: '.form_fields__field',
            errorWrapperClass: 'form_fields__field--has_warning',
            errorBoxClass: 'form_fields__field_warning'
        },
        addValidators: true
    },
    'forms-ext': {
        replaceUI: 'auto',
        types: 'number'
    }
});

webshim.polyfill('forms forms-ext');
aFarkas commented 8 years ago
webshim.setOptions({
    'debug': true,
    'forms': {
        replaceValidationUI: true,
        lazyCustomMessages: true,
        iVal: {
            fieldWrapper: '.form_fields__field',
            errorWrapperClass: 'form_fields__field--has_warning',
            errorBoxClass: 'form_fields__field_warning'
        },
        addValidators: true
    },
    'forms-ext': {
        replaceUI: {number: 'auto'},
        types: 'number'
    }
});
aFarkas commented 8 years ago

Please also note, that webshim is actually deprecated.