vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.12.5 vs vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.12.7

- old
+ new

@@ -1,5 +1,63 @@ + +//this might was already extended by ES5 shim feature +(function($){ + "use strict"; + var webshims = window.webshims; + if(webshims.defineProperties){return;} + var defineProperty = 'defineProperty'; + var has = Object.prototype.hasOwnProperty; + var descProps = ['configurable', 'enumerable', 'writable']; + var extendUndefined = function(prop){ + for(var i = 0; i < 3; i++){ + if(prop[descProps[i]] === undefined && (descProps[i] !== 'writable' || prop.value !== undefined)){ + prop[descProps[i]] = true; + } + } + }; + + var extendProps = function(props){ + if(props){ + for(var i in props){ + if(has.call(props, i)){ + extendUndefined(props[i]); + } + } + } + }; + + if(Object.create){ + webshims.objectCreate = function(proto, props, opts){ + extendProps(props); + var o = Object.create(proto, props); + if(opts){ + o.options = $.extend(true, {}, o.options || {}, opts); + opts = o.options; + } + if(o._create && $.isFunction(o._create)){ + o._create(opts); + } + return o; + }; + } + + if(Object[defineProperty]){ + webshims[defineProperty] = function(obj, prop, desc){ + extendUndefined(desc); + return Object[defineProperty](obj, prop, desc); + }; + } + if(Object.defineProperties){ + webshims.defineProperties = function(obj, props){ + extendProps(props); + return Object.defineProperties(obj, props); + }; + } + webshims.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + + webshims.getPrototypeOf = Object.getPrototypeOf; +})(window.webshims.$); //DOM-Extension helper webshims.register('dom-extend', function($, webshims, window, document, undefined){ "use strict"; var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized; var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute; @@ -631,10 +689,17 @@ this._create(); this.height = docObserve.getHeight(); this.width = docObserve.getWidth(); setInterval(this.test, 999); $(this.test); + if($.support.boxSizing == null){ + $(function(){ + if($.support.boxSizing){ + docObserve.handler({type: 'boxsizing'}); + } + }); + } webshims.ready('WINDOWLOAD', this.test); $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler); $(window).on('resize', this.handler); } } @@ -642,17 +707,11 @@ 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 || {}; @@ -1179,31 +1238,31 @@ $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers */ - var rElementsGroup = /^(?:form|fieldset)$/i; - var hasInvalid = function(elem){ - var ret = false; - $(elem).jProp('elements').each(function(){ - if(!rElementsGroup.test(this.nodeName || '')){ - ret = $(this).is(':invalid'); - if(ret){ - return false; - } - } - - }); - return ret; - }; var extendSels = function(){ var matches, matchesOverride; var exp = $.expr[":"]; + var rElementsGroup = /^(?:form|fieldset)$/i; + var hasInvalid = function(elem){ + var ret = false; + $(elem).jProp('elements').each(function(){ + if(!rElementsGroup.test(this.nodeName || '')){ + ret = exp.invalid(this); + if(ret){ + return false; + } + } + + }); + return ret; + }; $.extend(exp, { "valid-element": function(elem){ - return rElementsGroup.test(elem.nodeName || '') ? !hasInvalid(elem) :!!($.prop(elem, 'willValidate') && isValid(elem)); + return rElementsGroup.test(elem.nodeName || '') ? !hasInvalid(elem) : !!($.prop(elem, 'willValidate') && isValid(elem)); }, "invalid-element": function(elem){ return rElementsGroup.test(elem.nodeName || '') ? hasInvalid(elem) : !!($.prop(elem, 'willValidate') && !isValid(elem)); }, "required-element": function(elem){ @@ -1254,31 +1313,40 @@ } return false; }; } }; + var formExtras = { + noAutoCallback: true, + options: options + }; + var addModule = webshims.loader.addModule; + var lazyLoadProxy = function(obj, fn, args){ + lazyLoad(); + webshims.ready('form-validation', function(){ + obj[fn].apply(obj, args); + }); + }; + + var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition'; + var poCFG = webshims.cfg.wspopover; + + addModule('form-validation', $.extend({d: ['form-message']}, formExtras)); + + addModule('form-validators', $.extend({}, formExtras)); if($.expr.filters){ extendSels(); } else { webshims.ready('sizzle', extendSels); } - - + webshims.triggerInlineForm = function(elem, event){ $(elem).trigger(event); }; - var lazyLoadProxy = function(obj, fn, args){ - lazyLoad(); - webshims.ready('form-validation', function(){ - obj[fn].apply(obj, args); - }); - }; - - var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition'; - var poCFG = webshims.cfg.wspopover; + if(!poCFG.position && poCFG.position !== false){ poCFG.position = { at: 'left bottom', my: 'left top', collision: 'fit flip' @@ -1396,17 +1464,16 @@ } }); webshims.ready('WINDOWLOAD', lazyLoad); - if(modules['form-number-date-ui'].loaded && modules['form-number-date-api'].test()){ + if(modules['form-number-date-ui'].loaded && !options.customMessages && (modules['form-number-date-api'].test() || (Modernizr.inputtypes.range && Modernizr.inputtypes.color))){ webshims.isReady('form-number-date-ui', true); } }); ;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){ "use strict"; - var doc = document; var lazyLoad = function(name){ if(!name || typeof name != 'string'){ name = 'DOM'; } if(!lazyLoad[name+'Loaded']){ @@ -1697,6 +1764,6 @@ } //init datalist update initializeDatalist(); })(); -}); \ No newline at end of file +});