enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

Update documentation for html api, array syntax, and options names #60

Closed Burtsev-Alexey closed 11 years ago

Burtsev-Alexey commented 11 years ago

It took me lots of time to figure out array syntax for data-ot arrays, there is nothing said about it in doc, most people would try "one, two" for arrays btw.

Also the names of options (data-ot-optionName) is not listed anywhere, you use some name transformation convention from object API names, but it's not said what it is.

enyo commented 11 years ago

Hi, sorry for the array. Please see #58 for that.

As for the option names, the first paragraph in the documentation explains that:

When the document is loaded Opentip scans the document and finds all elements with a data-ot attribute, and instantiates an Opentip automatically. To configure the Opentip this way simply add attributes beginning with data-ot- and the dashed option name. Example:

<div data-ot="The content" data-ot-delay="2" data-ot-hide-trigger="closeButton">Hover me</div>

Burtsev-Alexey commented 11 years ago

It's not simply dashed option name, it's: lowercased and for every capital you need a dash, ie: showOn == data-ot-show-on, I was able to figure this out only by examing source code.

According to documentation it should be data-ot-showOn

Burtsev-Alexey commented 11 years ago

And where in documentation you say that array should be specified using [space'value'space] syntax...

enyo commented 11 years ago

Hi @Burtsev-Alexey sorry, I assumed that the term dashed is pretty well known, but apparently I should document it better. The way I always encountered dashed (or hyphenated) meant that every uppercase letter should be turned lowercase, and prefixed with a dash. So, showOn becomes show-on and myAwesomeVar becomes my-awesome-var.

I thought that the example on the page clarified that enough, but evidently it needs improvement.

As for the array specification: The issue I referenced (#58) states that it's currently not possible to do so. You need to define it programmatically.

Burtsev-Alexey commented 11 years ago

Yeah, I know about array bug in data-ot, I'm talking about array syntax, not about that it's doesn't work, or the syntax with space before ' is a bug? and arrays supposed to be declared like ['one','two'] withput space