Better HN
topnewbestaskshowjobs
Log inSign up

deadbeef84

5 karma · joined Feb 27, 2012 (14y ago) · 4 submissions

Submissions

comment 14y ago · link · parent

If you have many options, they are easier to retrieve, just call .data('tooltip') and jQuery will do the parsing of the object. Using separate attributes you would have to call .data() for every attribute. Anyway, I guess any of the two methods would be fine! :-)

comment 14y ago · link · parent

6. Prevention of double instantiation.

comment 14y ago · link · parent

Here's my thoughts:

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.

comment 14y ago · link · parent

Not sure I agree completely, "watch" is when you're actually interested in what's going on in the project. "Fork" is when you want to contribute with code changes. Maybe a "Like" button to show your appreciation would be nice?