vendor/assets/javascripts/webshims/shims/form-shim-extend.js in webshims-rails-0.4.6 vs vendor/assets/javascripts/webshims/shims/form-shim-extend.js in webshims-rails-0.4.7

- old
+ new

@@ -349,11 +349,11 @@ webshims.defineNodeNamesBooleanProperty(['input', 'textarea', 'select'], 'required', { set: function(value){ $(this).getShadowFocusElement().attr('aria-required', !!(value)+''); }, - initAttr: (!$.browser.msie || webshims.browserVersion > 7)//only if we have aria-support + initAttr: (Modernizr.localstorage)//only if we have aria-support }); webshims.reflectProperties(['input'], ['pattern']); @@ -664,18 +664,17 @@ return $.attr(this, 'novalidate') != null; } } }); -if($.browser.webkit && Modernizr.inputtypes.date){ +if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){ (function(){ var noInputTriggerEvts = {updateInput: 1, input: 1}, fixInputTypes = { date: 1, - time: 1, - "datetime-local": 1 + time: 1 }, noFocusEvents = { focusout: 1, blur: 1 }, @@ -1095,12 +1094,11 @@ })(); } (function(){ Modernizr.textareaPlaceholder = !!('placeholder' in $('<textarea />')[0]); - var bustedTextarea = $.browser.webkit && Modernizr.textareaPlaceholder && webshims.browserVersion < 535; - if(Modernizr.input.placeholder && Modernizr.textareaPlaceholder && !bustedTextarea){return;} + if(Modernizr.input.placeholder && Modernizr.textareaPlaceholder){return;} var isOver = (webshims.cfg.forms.placeholderType == 'over'); var isResponsive = (webshims.cfg.forms.responsivePlaceholder); var polyfillElements = ['textarea']; if(!Modernizr.input.placeholder){ @@ -1298,12 +1296,12 @@ $.each(['Left', 'Top'], function(i, side){ var size = (parseInt($.css(elem, 'padding'+ side), 10) || 0) + Math.max((parseInt($.css(elem, 'margin'+ side), 10) || 0), 0) + (parseInt($.css(elem, 'border'+ side +'Width'), 10) || 0); data.text.css('padding'+ side, size); }); - $(elem) - .on('updateshadowdom', function(){ + $(document) + .onTrigger('updateshadowdom', function(){ var height, width; if((width = elem.offsetWidth) || (height = elem.offsetHeight)){ data.text .css({ width: width, @@ -1311,11 +1309,10 @@ }) .css($(elem).position()) ; } }) - .triggerHandler('updateshadowdom') ; } else { var reset = function(e){ if($(elem).hasClass('placeholder-visible')){ @@ -1367,21 +1364,15 @@ polyfillElements.forEach(function(nodeName){ var desc = webshims.defineNodeNameProperty(nodeName, 'placeholder', { attr: { set: function(val){ var elem = this; - if(bustedTextarea){ - webshims.data(elem, 'textareaPlaceholder', val); - elem.placeholder = ''; - } else { - webshims.contentAttr(elem, 'placeholder', val); - } + webshims.contentAttr(elem, 'placeholder', val); pHolder.update(elem, val); }, get: function(){ - var ret = (bustedTextarea) ? webshims.data(this, 'textareaPlaceholder') : ''; - return ret || webshims.contentAttr(this, 'placeholder'); + return webshims.contentAttr(this, 'placeholder'); } }, reflect: true, initAttr: true }); @@ -1393,16 +1384,12 @@ var desc; ['attr', 'prop'].forEach(function(propType){ placeholderValueDesc[propType] = { set: function(val){ var elem = this; - var placeholder; - if(bustedTextarea){ - placeholder = webshims.data(elem, 'textareaPlaceholder'); - } - if(!placeholder){ - placeholder = webshims.contentAttr(elem, 'placeholder'); - } + var placeholder = webshims.contentAttr(elem, 'placeholder'); + + $.removeData(elem, 'cachedValidity'); var ret = desc[propType]._supset.call(elem, val); if(placeholder && 'value' in elem){ changePlaceholderVisibility(elem, val, placeholder); }