-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tooltipster refactoring #75
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… from the check interval. The tooltip will not react anymore to a content change made without calling the update method, at least for now.
…iginal element, replaced by instance variables. Removed confusing variable names and used the self name convention. Removed useless var repetitions. Removed the awkward getContent function (to be replaced later).
…viously collide with each other or even with the rest of the page before I namespaced
…hat allowed to interact with the tooltips inside a container
…ly bindings on the window all go to the end
…ot accurate anyway
…any form, especially an object with bindings etc. It is not tooltipster's job to filter stuff in the content and try to prevent XSS: people should not allow everything in their title attribute in the first place. Besides, the existing getContent function caused issues and not working adequately either
…ip if interactiveAutoClose is true. The plugin should not dictate an arbitrary behavior of some content of the tooltip, users should instead bind their content as they wish to the desired public methods.
…ferent from tooltipster
…ialized with this value to true currently closes tooltips even if they have been set to interactive and not autoclosable. As the plugin is getting more robust and ready for heavy interactions, this behavior is questionable and should at least be disabled by default. Most people will not see the difference anyway since tooltips are closed quickly by default.
…ipstered class and the regular public method
…e the result can now be jquery objects and not only strings, if that is that's what was provided as content in the first place. Also sorted methods by alphabetical order.
…for retrocompatibility but is deprecated.
… failing silently and returning 'this'. Will help debug typos.
…ot be called at all so things can happen synchronously
…tip is open, as it is no longer necessary since this interval is no longer in charge of updating the content. Also forgot to set the interval back at 200ms after testing, oops. Done.
…ctually valid content, while only null is the absence of content
…he form of an html object. Now cloning content and icon when it is provided in the form of objects, as a same object can be set as parameter of several instances and should not be shared between them
louisameline
added a commit
that referenced
this pull request
Oct 31, 2013
Merge Tooltipster refactoring into dev branch
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tooltipster got refactored, hopefully it will be more readable and maintainable. It also got a batch a bug fixes and some new features. The plugin is now more robust and should enable more complex use cases, particularly concerning interactive tooltips.
Changes involve :
.data()
calls (almost all of them) as there was no reason to bind to the DOM in this manner, preferred instance variablesupdate
method is now immediate, having seperated the checkInterval and the content update processcontent
is available. It acts as a getter when used like.tooltipster('content')
, as a setter when used like.tooltipster('content', data)
. The getter call replaces theval
method that has been around for only a few days. The setter call replaces theupdate
method which is now deprecated (but still working for backward compatibility).tooltipster('content')
method will return a jQuery object if this is what you provided in the "content" options of the constructor, or via a previous.tooltipster('content', $data)
call. Please note that if objects are passed, they will actually be deeply cloned and it is their clone that will be used, unless the new optioncontentCloning
andiconCloning
are set tofalse
. Also, if you provide an object as an icon, it will not be applied the iconTheme as it is assumed that you will have styled it by yourself and will want no css property conflicts.functionInit
behavior got its original behavior back with origin and content parameters (see Added an init callback function in options #63 and changed functionInit behavior #67)title=""
attribute results in an empty tooltip being shown. Do not set a title attribute at all if you want to initialize the tooltip without a content (and thus preventing it from showing up). In the same manner, use.tooltipster('content', null)
to actually set an empty content via the API. This is also why the default value of thecontent
option is now being set to null rather than an empty string.Behaviors that have changed
don't worry, almost no code-breaking changes for people who properly use the plugin by its public methods rather than its internals (as they should ;). Just check my last point, but I hope no one was actually using that feature anyway.
update
method. I believe that kind of "magic" is not good practice anyway, but autoAnimation parameter may be considered at some point, we'll see.data()
calls on elements may run into trouble, please now use the properelementIcon
,elementTooltip
etc methods when you want to build complex interactive tooltips.onlyOne
option now defaults to false to avoid unexpected conflicts with non-autoClosing tooltips, see my commit comment on that.tooltipster('update', data)
method is still working but deprecated, please use.tooltipster('content', data)
insteadinteractiveAutoClose
option and theelementTooltip
andhide
methods to set up your own bindings and behaviors$('body').tooltipster('hide')
. This was unnecessery and slow anyway, please just use some simple$('.mytooltips').tooltipster('hide')
bit of code. That was almost not documented anyway, just mentioned in an example in the doc that should be amendedThank you.