Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix tooltip.addClass() argument #5235

Closed
wants to merge 1 commit into from

Conversation

suncat2000
Copy link
Contributor

If used jQuery UI, second argument for .addClass() is duration

.addClass( className [, duration ] [, easing ] [, complete ] )

.addClass()

duration (default: 400)
Type: Number or String
A string or number determining how long the animation will run.

tooltip.addClass(placement[0], options.placementClassPrefix + ttPosition.placement);

This code give move animation with default duration value {duration: 400}
May be this animation effect not needed?

If used jQuery UI, second argument for .addClass() is duration
@icfantv
Copy link
Contributor

icfantv commented Jan 13, 2016

@suncat2000, i'm not sure what problem this PR is attempting to solve. We do not rely on jquery at all and certainly not jquery UI.

@suncat2000
Copy link
Contributor Author

@icfantv tooltip have fade in animation optional, may be add option for fix this animation effect?

@icfantv
Copy link
Contributor

icfantv commented Jan 13, 2016

@suncat2000, i don't follow. what about your jqueryUI comments?

@suncat2000
Copy link
Contributor Author

@icfantv jQueryUI library override some jQuery methods Method Overrides. For example .addClass() method.
This built-in jQuery signature .addClass( className )
jQuery .addClass()
and this jQueryUI signature: .addClass( className [, duration ] [, easing ] [, complete ] )
jQueryUI .addClass()

if I use jQueryUI and angular-ui/bootstrap v1.0.x in project, this code:

tooltip.addClass(placement[0], options.placementClassPrefix + ttPosition.placement);

worked with animation, because in .addClass() passed second argument.
https://github.com/jquery/jquery-ui/blob/0bfbd21d4fefa98d165b7d50277bd23be84e919a/ui/effect.js#L871

@icfantv
Copy link
Contributor

icfantv commented Jan 13, 2016

@suncat2000, we don't support running Angular UI Bootstrap with jQuery UI because you're not supposed to be using Bootstrap with jQuery UI. The amount of bloat that would add is just staggering.

The addClass method is provided by jqLite which is bundled with Angular. If you pull in the full version of jQuery in front of Angular, then you wind up using the full version of jQuery. If you pull in another 3rd party library which overrides an API method used by Angular (either natively or via a 3rd party) then this is something that's way beyond our control.

@pkozlowski-opensource
Copy link
Member

Agree with @icfantv - we really don't want to go down this (very slippery) path...
This would be -1 from me for this PR

@suncat2000
Copy link
Contributor Author

@icfantv, @pkozlowski-opensource I agree use jQueryUI in conjunction with Angular not the best solution, but I use this popular package angular-dragdrop and this package has dependency from jQueryUI.
I need migrate to another package (without dependency from jQueryUI) or use only 1.14.3 version of angular-ui/bootstrap because of one line of code?

@suncat2000
Copy link
Contributor Author

@icfantv, @pkozlowski-opensource the effect that I get when using angular-ui/bootstrap v1.0.x with jQueryUI: http://take.ms/kIsaH

@suncat2000
Copy link
Contributor Author

@icfantv, @pkozlowski-opensource if I understand correctly, Angular's jqLite provides buit-in jQuery .addClass() method with one argument String or Function:
https://docs.angularjs.org/api/ng/function/angular.element
http://api.jquery.com/addClass/
in current code .addClass() method called with 2 arguments:

tooltip.addClass(placement[0], options.placementClassPrefix + ttPosition.placement);

What for?

@wesleycho
Copy link
Contributor

Looking at jqLite's code here, it seems that it also doesn't support the second argument.

This looks like there is something wrong with the addClass method here.

Worse, it looks like removing either the first or second parameter doesn't break the tests.

@RobJacobs looking at the history, looks like d265113 is what caused this - can you give an explanation of what was intended here?

@RobJacobs
Copy link
Contributor

@wesleycho That was an error on my part, this PR fixes a legitimate bug. The intent was to add the primary placement class (top, left, right, bottom) that are supported by the TWBS css and the placement class generated by the position service (primaryposition-secondaryposition). The second class is added to give folks a chance to use their own css and use the positioning approach described in my first post here

@wesleycho
Copy link
Contributor

Alright, that's what it looked like, but I wanted to be absolutely sure.

@wesleycho wesleycho added this to the 1.0.4 milestone Jan 14, 2016
@wesleycho
Copy link
Contributor

I am going to merge this, and open a PR with a unit test for this just so the test can be reviewed (the test is indeed fixed by this PR).

@suncat2000
Copy link
Contributor Author

@wesleycho, @RobJacobs thanks! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants