Closed neffets closed 9 years ago
Hi!
First, jQuery does an automatic conversion of data key names. Example:
> jQuery("body").data("foo-bar", "baz").data()
< Object {fooBar: "baz"}
So, if you want to set the info url, you would have to use something like $("shariff").data("info-url", "blah")
(also notice data()
instead of attr()
). Since Object.observe()
is not supported by most browsers, Shariff can't detect changes made on the data list. And there is no update()
method on the shariff object yet.
I just pushed a (not released) change, that renames _Shariff
to Shariff
and that exports the class to the global window object. I also pushed an example that shows how to pass own options to the Shariff constructor method.
Summary:
a) use data-info-url
instead of data-infourl
/data-infoUrl
b) there is no reason to change it
c) Custom options could always be passed to the constructor. The change, that sets the Shariff
class in the global window object, will be released soon.
In current Firefox, its not possible to add an own infoUrl per data-attribute
The browser will add the data-attribute, BUT it will become a "data-infourl" (all lowercase).
There are three ways to solve it:
see Issue #34
data-options="{infoUrl: 'http://www...', theme: 'white'}"