-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
tooltip('toggle') fixed, also added container option for where the tooltip gets placed #5768
Conversation
damn travis.. I'll see if I can figure out what broke there Update.. test("should show tooltip with delegate selector on click", function () {
var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
var tooltip = div.appendTo('#qunit-fixture')
.tooltip({ selector: 'a[rel=tooltip]',
trigger: 'click' })
div.find('a').trigger('click')
ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
}) and then with some testing on my own with a fiddle it seems that somehow the not sure how or why, or how to fix this one.. but everything else seems to be working |
@demike helped fix this so it would pass the unit tests
added the unit tests from @WilliamStam's pull request twbs#5830
put container variable where it belongs, and made it only call to the dom when container option is found
needed 3 =, not 2
thanks ... overriding the toggle fixed popovers for me (I extend the popover functionality with Bootstrapx Clickover: https://github.com/lecar-red/bootstrapx-clickover) |
+1 for this pull request. |
+1, this is exactly what I did in my application to fix popovers since there tend to be a lot of modal/tab controls I couldn't have every popover appended to body. Appending to a specified container also allowed me to do this in the Tooltip class:
Which will hide any tooltips/popovers when a modal is closed. |
@jschr thats one way to do it, for modals I've been doing |
@Yohn Yes but only if you use the hover trigger wouldn't it? If you use popovers with a manual or click trigger they will stay open if you reopen the modal. I had the same issue with tabs and accordions as well. |
It should work with the click or manual trigger, but I dont remember trying it yet.. |
I see that youre talking with the popovers staying up on reload of the modal.. |
Good looking out, hopefully this makes it for the next build. 👍 |
Would be much easier and better to just do something like:
Of course, if insertAfter is preferred then use that - but why create a jQuery object when it isn't required. Especially since the |
@blakeembrey I wanted to keep the same kind of idea they had for the tooltips with insertAfter but you did bring up a valid point with creating an object for the container when its not needed.. my main computer is down right now, so I'm trying to reinstall everything so once thats completed I'll try to modify this request |
@Yohn I understand that - but I think the insertAfter method is flawed. For one, it doesn't seem work at all inside button groups because as the element is inserted between buttons it creates a small (about 1px) gap between the buttons. I tried every CSS hack in the book to remove it to, but to no avail. Plus it can break a lot more things, such as code that is relying on adjacent selectors. Also, could you squash the commits after you do the latest commit? Just so I can see all the changes (no sure if I missed something over the four or so commits). Thanks |
my main computer is still down, I think I gotta put in a new heat pad, so until I do that I cant use git to try to send a request in.. I can edit the files on github and send em that way.. I'm not sure how to squash commits either, so that makes me want to open another request, and close this one out cause I can see that this one it would be complicated to figure out what was changed.. and theres 2 different bug fixes within this one, the insert strategy of the tooltips and tooltip('toggle') |
tooltip('toggle') is broken in current bootstrap download -- http://jsfiddle.net/SqFbx/ and with the changes it works -- http://jsfiddle.net/SqFbx/1/ thanks to @demike for helping fix this issue. This is also part 1 of a pull request that was closed - twbs#5768
@blakeembrey I'm playing with this request again to submit it, and came up with a potential problem and was looking for your advice possibly, maybe someone elses? anyways, how I did it in this request was to see if the container was a valid container in the source with container = this.options.container === '' ? '' : $(this.options.container)
container.length ? $tip.appendTo(container) : $tip.insertAfter(this.$element) so what thats doing is seeing if there is a container option, and then creating an unneeded object for that container to check its length / if its in the source.. If its in the source then the tooltip is appended to that container, and If its not then it gets inserted after the element.. I believe that it needs to check if the container is there because if its not then the tooltip will not appear, would there be a different way to go about checking if the container is in the source? or would I have to create that object for it to make sure its valid? |
I'm not sure about checking if the container exists before inserting it. The element should be up to the developer to implement. If you really wanted this feature though, you could do this.options.container && $tip.appendTo(this.options.container).length || $tip.insertAfter(this.$element) Still not 100% sure about using |
yeah, I really dont like using I like the idea of putting the I've been playing with a fiddle - http://jsfiddle.net/R23KB/1/ trying to come up with something, and realized another bug with tooltips within the modals.. they seem to get cut off it it goes over the edge of |
@Yohn Yeah, that's my fault. Need to upgrade the tooltip to stop using |
@blakeembrey I just figured out why it was going over the edges there.. it was because of setting the container to |
* web-app/js/bootstrap-2.2.1.js tooltip toggle is not working. There is an issue filed: twbs/bootstrap#5753 A pull request with this change is open: twbs/bootstrap#5768 So hopefully, this will be fixed in next release, so we don't have to re-apply. git-svn-id: https://ctf.open.collab.net/svn/repos/svnedge/trunk@3365 03e8f217-bfc6-4b7c-bcb7-0738c91e2c5f
This is an old pull request
Both of these bugs have been fixed in 2.3.0
please refer to the following requests--
#6321 to fix the insert strategy and use a container option
#6176 fixes the tooltip('toggle') feature which is currently broken.
refer to #5753
.tooltip('toggle') and .popover('toggle') was broken, so heres the fix
took me forever to get this request to send right, but I think I got it this time
thanks to @demike for helping correct the problem
Also, within the pull request is an alternate way of doing the insertAfter or appendTo options noted within #5830 to fix the problems within #5687
I found out after I changed my -wip branch that it updates this pull requests with my changes, thats why they're in the same pull
How to use the new container option..
you can use html5 elements --
data-container="body"
or with javascript -$().tooltip({ container: 'body' })
and the container value, can be any element on the page, and for tooltips within modals I've been using
container: '.modal'
or'.modal-body'