Geeks With Blogs

News

Ivan Porto Carrero Placeholder.Add("Really Cool Stuff");

If you're not using the control toolkit for The asp.net 2.0 atlas framework and are doing some client side scripting. you may find that the April CTP has doesn't always work in the safari browser.

This is in part due to the way that safari attaches events.

In the control toolkit they use the following script to "patch" the april CTP of The asp.net 2.0 atlas framework to support safari a whole lot better. Some might find it useful :-)

   40     // This fixes a bug in the The asp.net 2.0 atlas framework Safari compatibility layer that

   41  // prevents chaining multiple handlers to an event.  We will remove

   42  // this after an The asp.net 2.0 atlas framework CTP refresh resolves the underlying issue.

   43  //

   44  if (window.__safari) {

   45     window.console.log("Patching Safari compat layer");

   46     (function() {

   47         var attachEventProxy = function(eventName, eventHandler) {

   48             this.addEventListener(eventName.slice(2), eventHandler, true);

   49         }

   50 

   51         var detachEventProxy = function (eventName, eventHandler) {

   52             this.removeEventListener(eventName.slice(2), eventHandler, true);

   53         }

   54 

   55         window["HTMLHtmlElement"] = document.createElement("html").constructor;

   56 

   57         function HTMLElement() {}

   58 

   59         HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__;

   60         var HTMLDocument = document.constructor;

   61         window.attachEvent = attachEventProxy;

   62         window.detachEvent = detachEventProxy;

   63         HTMLDocument.prototype.attachEvent = attachEventProxy;

   64         HTMLDocument.prototype.detachEvent = detachEventProxy;

   65         HTMLElement.prototype.attachEvent = attachEventProxy;

   66         HTMLElement.prototype.detachEvent = detachEventProxy;

   67 

   68     })();

   69 }

Posted on Thursday, June 29, 2006 7:12 PM Atlas | Back to top

Copyright © Ivan Porto Carrero | Powered by: GeeksWithBlogs.net