vendor/assets/javascripts/webshims/shims/dom-extend.js in webshims-rails-1.12.5 vs vendor/assets/javascripts/webshims/shims/dom-extend.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,16 +707,10 @@ 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 || {};