vendor/assets/javascripts/webshims/shims/dom-extend.js in webshims-rails-0.4.2 vs vendor/assets/javascripts/webshims/shims/dom-extend.js in webshims-rails-0.4.3
- old
+ new
@@ -386,11 +386,11 @@
var lastWidth;
var handler;
var docObserve = {
init: false,
start: function(){
- if(!this.init){
+ if(!this.init && document.body){
this.init = true;
this.height = $(document).height();
this.width = $(document).width();
setInterval(function(){
var height = $(document).height();
@@ -398,11 +398,11 @@
if(height != docObserve.height || width != docObserve.width){
docObserve.height = height;
docObserve.width = width;
handler({type: 'docresize'});
}
- }, 400);
+ }, 600);
}
}
};
handler = function(e){
@@ -414,12 +414,14 @@
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
- docObserve.height = $(document).height();
- docObserve.width = $(document).width();
+ if(document.body){
+ docObserve.height = $(document).height();
+ docObserve.width = $(document).width();
+ }
}
$.event.trigger('updateshadowdom');
}, 40);
};
$(window).bind('resize', handler);
@@ -461,11 +463,13 @@
if(opts.data){
shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
}
opts = null;
- docObserve.start();
+ webshims.ready('DOM', function(){
+ docObserve.start();
+ });
}
})(),
propTypes: {
standard: function(descs, name){
createPropDefault(descs);
@@ -605,10 +609,10 @@
if(!_noTmpCache && descs[prop].initAttr){
initProp.createTmpCache(name);
}
if(propType){
if(descs[prop][propType]){
- webshims.log('override: '+ name +'['+prop +'] for '+ propType);
+ //webshims.log('override: '+ name +'['+prop +'] for '+ propType);
} else {
descs[prop][propType] = {};
['value', 'set', 'get'].forEach(function(copyProp){
if(copyProp in descs[prop]){
descs[prop][propType][copyProp] = descs[prop][copyProp];