#1320 enhancement

Element.addMethods fails for method named as existing property

Reported by Victor | February 29th, 2012 @ 08:34 AM | in Inline documentation

See https://groups.google.com/forum/?pli=1#!topic/prototype-scriptaculo...

The following code causes error in IE9 and fails silently in FF10:

document.observe('dom:loaded', function() {
    Element.addMethods("select", {
        size: function(element) {
            return element.select('options').size();

This happens because:
1. Property size already exists for HTMLSelectElement in IE and FF
2. destination[property] in mergeMethods() fails in IE for prototype of HTMLSelectElement and size

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket