things that I'd love to see on the next verion of prototype

5 views
Skip to first unread message

Ran Berenfeld

unread,
Aug 20, 2011, 3:23:42 AM8/20/11
to prototype-s...@googlegroups.com
guys
I'm running a wonderful website with prototype, the israeli chess website at www.ichess.co.il
here are some stuff that I think are missing from prototype :

1. mouse wheel event (I found some custom code that did it)
2. ajax abort method
3. error handling (cross browser code that catches errors and returns an object with the URL, stack trace,etc)
    I think its even possible that the entire prototype code will be run under try catch so that error can be reported even
    from within prototype
4. some more string methods here are some custom stuff that I added in my scripts (for ideas...)
5. some more array methods (like get from array with a field/id in the objects in the array, check if array contains a value, etc)

below - some functions that I added for ideas...

Thanks
Ran

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
};

String.prototype.ltrim = function() {
    return this.replace(/^\s+/,"");
};

String.prototype.rtrim = function() {
    return this.replace(/\s+$/,"");
};

String.prototype.removeLastChar = function() {
    return this.substr(0, this.length - 1);
};

function isValid(object)
{
    return (object !== null) && (object !== undefined);
}

function isValidString(str)
{
    return (isValid(str) && (str !== ""));
}

function isValidEmail(str)
{
    if (! isValidString(str)) {
        return false;
    }
    return (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/).test(str);
}


Victor

unread,
Aug 22, 2011, 5:58:00 AM8/22/11
to prototype-s...@googlegroups.com
+1 for mouse wheel event and ajax abort and timeout.

String.prototype.trim AKA strip() is already here.

E-mail validation pattern is under big question, e.g. regexp fully compatible with RFC 2822 will look like (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
Reply all
Reply to author
Forward
0 new messages