#1218 new
Moo

r/w wrapper for x-data attributes

Reported by Moo | February 16th, 2011 @ 12:41 PM

Hi there,

is it possible to have a wrapper around these new x-data-somewhat things in the lib?

Element.addMethods({
    xData: function(element, name, value) {
        element = $(element);
        if (Object.isUndefined(value)) {
            return element.readAttribute("x-data-" + name) || null;
        } else {
            return element.writeAttribute("x-data-" + name, value);
        }
    }
});

Thank you all.

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

Pages