* BlackBerry JavaScript Oddities

Posted on July 18th, 2010 by Dave Johnson. Filed under Uncategorized.


I have just discovered that the Element object in the BlackBerry browser (4.6+) supports the prototype object on some objects but not others. In particular the Element object supports it like this:

1
2
3
Element.prototype.addEventListener = function() {
    alert('foo');
};

but the following does not work on the Document object:

1
2
3
Document.prototype.addEventListener = function() {
    alert('bar');
};

What does work on the Document is overriding instance method like this:

1
2
3
document.addEventListener = function() {
    alert('foobar');
};

Strange but true!

If you have any other BlackBerry tidbits please let me know since these old versions of BlackBerry browser are going to be the IE6 of the the mobile web.



Trackback URI | Comments RSS

Leave a Reply