From beeb00efbeb2ea5925285c68e4f9a9f680b0ffdc Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 5 May 2006 03:21:33 +0000 Subject: Fixed #156. --- framework/Web/Javascripts/js/prado.js | 7 ++----- framework/Web/Javascripts/prado/element.js | 17 ++--------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js index 498a6cf7..56364428 100644 --- a/framework/Web/Javascripts/js/prado.js +++ b/framework/Web/Javascripts/js/prado.js @@ -253,11 +253,8 @@ Prado.Element={setValue:function(element,value) el.value=value;},select:function(element,method,value) {var el=$(element);var isList=element.indexOf('[]')>-1;if(!el&&!isList)return;method=isList?'check'+method:el.tagName.toLowerCase()+method;var selection=Prado.Element.Selection;if(isFunction(selection[method])) selection[method](isList?element:el,value);},click:function(element) -{var el=$(element);if(!el)return;if(document.createEvent) -{var evt=document.createEvent('HTMLEvents');evt.initEvent('click',true,true);el.dispatchEvent(evt);} -else if(el.fireEvent) -{el.fireEvent('onclick');if(typeof(el.onclick)=="function") -el.onclick();}},setAttribute:function(element,attribute,value) +{var el=$(element);if(el) +Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value) {var el=$(element);if(attribute=="disabled"&&value==false) el.removeAttribute(attribute);else el.setAttribute(attribute,value);},setOptions:function(element,options) diff --git a/framework/Web/Javascripts/prado/element.js b/framework/Web/Javascripts/prado/element.js index 06937253..0d9c74d1 100644 --- a/framework/Web/Javascripts/prado/element.js +++ b/framework/Web/Javascripts/prado/element.js @@ -26,21 +26,8 @@ Prado.Element = click : function(element) { var el = $(element); - //Logger.info(el); - if(!el) return; - if(document.createEvent) - { - var evt = document.createEvent('HTMLEvents'); - evt.initEvent('click', true, true); - el.dispatchEvent(evt); - //Logger.warn("dispatching click for "+el.id); - } - else if(el.fireEvent) - { - el.fireEvent('onclick'); - if(typeof(el.onclick) == "function") - el.onclick(); - } + if(el) + Event.fireEvent(el,'click'); }, setAttribute : function(element, attribute, value) -- cgit v1.2.3