Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal, estou com um problema num codigo javascript, que gera uma grid, fucniona normalmente no internet explorer, mas no firefox e chrome da erro is not defined:
Usando o firebug do firefox, ele da seguinte mensagem de erro:
var cs=ComputedCSSStyleDeclaration.prototype grid.js (linha 93 )
ReferenceError: ComputedCSSStyleDeclaration is not defined
A função de onde ele indica o erro:
function(){
if(!window.HTMLElement){
return}
var element=HTMLElement.prototype;
element.__proto__={__proto__:element.__proto__};
element=element.__proto__;
var capture=["click","mousedown","mouseup","mousemove","mouseover","mouseout" ];
element.setCapture=function(){
var self=this;
var flag=false;
this._capture=function(event){
if(flag){
return}flag=true;
self.dispatchEvent(event);
flag=false};
for(var i=0;i<capture.length;i++){
window.addEventListener(capture[i],this._capture,true);
window.captureEvents(Event[capture[i]])}};
element.releaseCapture=function(){
for(var i=0;i<capture.length;i++){
window.releaseEvents(Event[capture[i]]);
window.removeEventListener(capture[i],this._capture,true)}
this._capture=null};
element.attachEvent=function(name,handler){
if(typeof handler !="function"){
return}
var nsName=name.replace(/^on/,"");
var nsHandler=function(event){
window.event=event;
handler();
window.event=null};
handler[name]=nsHandler;
this.addEventListener(nsName,nsHandler,false)};
element.detachEvent=function(name,handler){
if(typeof handler !="function"){
return}
var nsName=name.replace(/^on/,"");
this.removeEventListener(nsName,handler[name],false);
handler[name]=null};
var getClientWidth=function(){
return this.offsetWidth - 20};
var getClientHeight=function(){
return this.offsetHeight - 20};
element.__defineGetter__("clientWidth",getClientWidth);
element.__defineGetter__("clientHeight",getClientHeight);
var getRuntimeStyle=function(){
return this.style};
element.__defineGetter__("runtimeStyle",getRuntimeStyle);
// Erro está aqui
var cs=ComputedCSSStyleDeclaration.prototype;
cs.__proto__={__proto__:cs.__proto__};
cs=cs.__proto__;
cs.__defineGetter__("paddingTop",function(){
return this.getPropertyValue("padding-top")});
var getCurrentStyle=function(){
return document.defaultView.getComputedStyle(this,"")};
element.__defineGetter__("currentStyle",getCurrentStyle);
var setOuterHtml=function(s){
var range=this.ownerDocument.createRange();
range.setStartBefore(this);
var fragment=range.createContextualFragment(s);
this.parentNode.replaceChild(fragment,this)};
element.__defineSetter__("outerHTML",setOuterHtml)})();
Favor quem puder me ajudar, desde ja agradeço !!
Carregando comentários...