Download

Concepts

Example

Documentation

Plugins

How to

Contribute

Links

extends.js

What is this ?

While we were developping the framework, we found that some methods of prototype didn't really answer to our needs. So we had a file with some utility method.

Global utility methods

_$(id | element)

The $ function of prototype is really convenient. You probably know that it returns a extended element with more methods. Most of the time, it is really nice. Except if you don't need these extra methods. So this method do exactly the same without these extra methods. So it is much faster (especially on IE6). More information about $ at prototypejs.org.

elementExists(id)

This method will test if an element with the id id exists in the DOM.

Extension of Prototype.Browser

You probably know the Prototype.Browser object. It permit you to know what type of browser is executing your script. The problem is that it only detects IE, Opera, WebKit, Gecko and MobileSafari. So we add more : IE6, IE7, FIREFOX3, FIREFOX2, FIREFOX, NETSCAPE9, NETSCAPE7, NETSCAPE, OPERA9, OPERA, CHROME and SAFARI.

You use it as usual :

Prototype.Browser.IE6

Utility methods for Function

bindAsRealEventListener(object)

This method is really close to the bindAsEventListener() prototype method except the binded method will only receive the event and no more arguments. This is the one we use to bind listener in the framework. It is a little bit faster than bindAsEventListener().

bindContext(object)

This method is really close to the bind() prototype method except the binded method will only receive the context and nothing else. It is a little bit faster than bind().