Changes between Initial Version and Version 2 of Ticket #11637


Ignore:
Timestamp:
Aug 25, 2010, 9:31:26 PM (11 years ago)
Author:
dante
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11637 – Description

    initial v2  
    1 This is probably the most often requested bit of functionality for users when they are migrating from jQuery, and we don't have a simple solution. dojo.data is "too much", and telling folks to write their own plugin for it is silly. I wrote on, it lives in plugd. It differs slightly from $.data in that you can pass a hash as a setter, and get an entire data object back by passing no parameters.
     1This is probably the most often requested bit of functionality for users when they are migrating from jQuery, and we don't have a simple solution. dojo.data is "too much", and telling folks to write their own plugin for it is silly. I wrote one, it lives in plugd. It differs slightly from $.data in that you can pass a hash as a setter, and get an entire data object back by passing no parameters.
    22
    33Exposes a single-node function dojo._data (which probably needs renamed, but is private ... )
    44
    5 One thing to note, and I'm note sure if I like it: Instead of following the other NodeList functions that return a map, I found the single-node case to be the most relevant. eg: dojo.query("#id").data("bar") ... most other NodeList functions return an array from .map, but I made this one determine if it is a single item list and return this[0]. Feels like magic, but the alternative is cumbersome:
     5One thing to note, and I'm note sure if I like it: Instead of following the other !NodeList functions that return a map, I found the single-node case to be the most relevant. eg: dojo.query("#id").data("bar") ... most other !NodeList functions return an array from .map, but I made this one determine if it is a single item list and return !this[0]. Feels like magic, but the alternative is cumbersome:
    66
    77{{{
     
    1616The magical version being not so magical and failing violently when your list is .length > 1 and you aren't expecting it to be.
    1717
    18 Thoughts?
     18Thoughts? The inline docs reflect the non-magical state, and will be updated to reflect whatever is decided.