vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.11.1 vs vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.11.2

- old
+ new

@@ -4,11 +4,11 @@ var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized; var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute; webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing; if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){ - webshims.error("IE browser modes are busted in IE10. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools"); + webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools"); } if(!$.parseHTML){ webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims."); } @@ -557,11 +557,11 @@ this.width = docObserve.getWidth(); setInterval(this.test, 600); $(this.test); webshims.ready('WINDOWLOAD', this.test); $(document).on('updatelayout', this.handler); - $(window).bind('resize', this.handler); + $(window).on('resize', this.handler); (function(){ var oldAnimate = $.fn.animate; var animationTimer; $.fn.animate = function(){ @@ -579,10 +579,17 @@ webshims.docObserve = function(){ webshims.ready('DOM', function(){ docObserve.start(); + if($.support.boxSizing == null){ + $(function(){ + if($.support.boxSizing){ + docObserve.handler({type: 'boxsizing'}); + } + }); + } }); }; return function(nativeElem, shadowElem, opts){ if(nativeElem && shadowElem){ opts = opts || {}; @@ -739,11 +746,16 @@ }, defineNodeNameProperty: function(nodeName, prop, descs){ havePolyfill[prop] = true; if(descs.reflect){ - webshims.propTypes[descs.propType || 'standard'](descs, prop); + if(descs.propType && !webshims.propTypes[descs.propType]){ + webshims.error('could not finde propType '+ descs.propType); + } else { + webshims.propTypes[descs.propType || 'standard'](descs, prop); + } + } ['prop', 'attr', 'removeAttr'].forEach(function(type){ var desc = descs[type]; if(desc){ @@ -925,11 +937,11 @@ var currentLang; var shortLang; var notLocal = /:\/\/|^\.*\//; var loadRemoteLang = function(data, lang, options){ var langSrc; - if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){ + if(lang && options && $.inArray(lang, options.availableLangs || options.availabeLangs || []) !== -1){ data.loading = true; langSrc = options.langSrc; if(!notLocal.test(langSrc)){ langSrc = webshims.cfg.basePath+langSrc; } @@ -1085,11 +1097,10 @@ } } }); })(webshims.$, document); - webshims.register('form-core', function($, webshims, window, document, undefined, options){ "use strict"; webshims.capturingEventPrevented = function(e){ if(!e._isPolyfilled){ @@ -1334,16 +1345,16 @@ /* * implement propType "element" currently only used for list-attribute (will be moved to dom-extend, if needed) */ - webshims.propTypes.element = function(descs){ + webshims.propTypes.element = function(descs, name){ webshims.createPropDefault(descs, 'attr'); if(descs.prop){return;} descs.prop = { get: function(){ - var elem = $.attr(this, 'list'); + var elem = $.attr(this, name); if(elem){ elem = document.getElementById(elem); if(elem && descs.propNodeName && !$.nodeName(elem, descs.propNodeName)){ elem = null; } @@ -1363,12 +1374,20 @@ var formsCFG = $.webshims.cfg.forms; var listSupport = Modernizr.input.list; if(listSupport && !formsCFG.customDatalist){return;} var initializeDatalist = function(){ + + var updateDatlistAndOptions = function(){ + var id; + if(!$.data(this, 'datalistWidgetData') && (id = $.prop(this, 'id'))){ + $('input[list="'+ id +'"], input[data-wslist="'+ id +'"]').eq(0).attr('list', id); + } else { + $(this).triggerHandler('updateDatalist'); + } + }; - var inputListProto = { //override autocomplete autocomplete: { attr: { get: function(){ @@ -1441,10 +1460,11 @@ webshims.objectCreate(shadowListProto, undefined, { input: elem, id: value, datalist: $.prop(elem, 'list') }); + elem.setAttribute('data-wslist', value); } else { elem.setAttribute('list', value); } $(elem).triggerHandler('listdatalistchange'); } @@ -1452,21 +1472,40 @@ initAttr: true, reflect: true, propType: 'element', propNodeName: 'datalist' }; + } else { + webshims.defineNodeNameProperties('input', { + list: { + attr: { + get: function(){ + var val = webshims.contentAttr(this, 'list'); + return (val == null) ? undefined : val; + }, + set: function(value){ + var elem = this; + webshims.contentAttr(elem, 'list', value); + webshims.objectCreate(options.shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')}); + $(elem).triggerHandler('listdatalistchange'); + } + }, + initAttr: true, + reflect: true, + propType: 'element', + propNodeName: 'datalist' + } + }); } webshims.defineNodeNameProperties('input', inputListProto); webshims.addReady(function(context, contextElem){ contextElem .filter('datalist > select, datalist, datalist > option, datalist > select > option') .closest('datalist') - .each(function(){ - $(this).triggerHandler('updateDatalist'); - }) + .each(updateDatlistAndOptions) ; }); }; @@ -1507,9 +1546,10 @@ this.datalist = datalist; this.id = opts.id; this.hasViewableData = true; this._autocomplete = $.attr(opts.input, 'autocomplete'); $.data(opts.input, 'datalistWidget', this); + $.data(datalist, 'datalistWidgetData', this); lazyLoad('WINDOWLOAD'); if(webshims.isReady('form-datalist-lazy')){ this._lazyCreate(opts); \ No newline at end of file