#250 enhancement

Support for .dataset property and data-* attributes

Reported by arty | July 28th, 2008 @ 08:03 PM

Spec of HTML5 describes way to include hidden data in elements via data-* attributes, easily accesible as properties of .dataset property. There's no support for this in browsers, however it's easily emulated:

    getDataset: function(element) {
        if (element.dataset) return element.dataset;
        var match, dataset = {};    
            if (attr.localName.startsWith('data-')) 
                dataset[attr.localName.substring(5)] = attr.nodeValue; 
        return element.dataset = dataset;

I believe this may be inclided in core due to very small size and high convenience.

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