1. Ability to modify default settings
It is sometimes nice to set the global defaults.
2. Ability to expose methods.
A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky.
3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin, but I think it could be for others. I hate it when I need initialize every instance separately just to specify it's options, when they could be specified in the markup.
4. Missing var before $settings. Just a typo I guess?
5. I think the name generate() is a bit misleading, init() or initialize() makes more sense to me.
I like your points for 1 and 2, will add those in the next iteration, constantly trying to improve this thing.
I didn't use init() because sometimes I may use init to do something else that doesn't deal with generating the plugin code, so I ended up going with generate(), maybe create() would be a better word.
Not sure you should be (ab)using data- attributes like that. They’re already a key/value pair so you markup your data as <div data-tooltip-foo="baa" data-tooltip-qux="quux">
deadbeef84|14 years ago
1. Ability to modify default settings It is sometimes nice to set the global defaults.
2. Ability to expose methods. A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky.
3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin, but I think it could be for others. I hate it when I need initialize every instance separately just to specify it's options, when they could be specified in the markup.
4. Missing var before $settings. Just a typo I guess?
5. I think the name generate() is a bit misleading, init() or initialize() makes more sense to me.
rduchnik|14 years ago
I didn't use init() because sometimes I may use init to do something else that doesn't deal with generating the plugin code, so I ended up going with generate(), maybe create() would be a better word.
robin_reala|14 years ago
deadbeef84|14 years ago
paulirish|14 years ago
rduchnik|14 years ago
Rust|14 years ago
Thanks a lot, it saved me a pile o'trouble :)
AndrewHampton|14 years ago
lhorie|14 years ago
rduchnik|14 years ago
emehrkay|14 years ago