-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix(tooltip): do not toggle when isOpen
is not boolean
#4400
Conversation
- Coerce `isOpen` to boolean to do a proper comparison for firing `toggleTooltipBind`
dd9de6f
to
7a6c8e7
Compare
Not sure if that is readable or not. One important thing. If you deactivate a JSHINT rule (with I would also add a test. |
Can you explain about the readable and jshint parts? There is no other good way to write this, due to val possibly not being a boolean, and a strict comparison is being done to a boolean. I could change it to a weak equality check, but that is pretty onerous and it becomes unobvious why we would want a weak check. For the jshint change, can you explain with an example block of what you mean? |
Of course. Readable for me is because you need more than a couple of seconds to realize what is going on on that line. If you say there is no better way, I am fine with it. The biggest issue for me is having to disable jshint rules for me, that is like a big sign of "Are you sure?". I am not up to date with the issue, but can't you do something like: val = !!val;
if (val !== ttScope.isOpen) { .. } At least to avoid jshint. Now, about the jshint thing. You know that jshint has lot of rules and they will make you fail the checking. To avoid that, you can disable a jshint rule with that you did, but that will disable it for the rest of the file. You can put the rule up again. So the idea is: /* jshint -W123 */
// Code that breaks rule 123
/* jshint +W123 */
// Rule 123 is activated again You can see that in action here: https://github.com/angular/angular.js/blob/master/src/ng/parse.js#L805-L821 Where angular disables the "new Function" protection because they needed it. |
I could make the change, but IMO it doesn't make it any easier to read - my opinion is that JSHint is wrong here, but it doesn't sound like they're going to change their stance on this from what I could tell. I'll make the changes necessary and write a test around this sometime this weekend. |
Don't bother wes. Leave it as is (fixing jshint rule) and add that test please. |
How do i help get this change as part of a build? Am new to all this |
This is a rollup commit intended to address several issues around the positioning and parsing of attributes. - Fixes issue introduced under PR angular-ui#4311 where setting height and width in tooltip position function messed up arrow placement. - Fixes issue introduced under PR angular-ui#4363 where setting visibility to hidden in tooltip position function caused elements in popover to lose focus. - Fixes issue angular-ui#1780 where tooltip would render if content was just whitespace. - Fixes issue angular-ui#3347 where tooltip isolate scope was being accessed after it was set to null. Observers will now be created/destroyed as tooltip opens/closes which will also offer a performance improvement. - Fixes issue angular-ui#3557 by implementing evalAsync to set tooltip scope isOpen property. - Fixes issue angular-ui#4335 where if model isOpen property is undefined, tooltip would call show/hide toggle function. - Closes PR angular-ui#4429 where how the templated content was being evaluated could cause an infinite digest loop. Closes angular-ui#4400 Closes angular-ui#4418 Closes angular-ui#4429 Closes angular-ui#4431 Closes angular-ui#4455 Fixes angular-ui#1780 Fixes angular-ui#3347 Fixes angular-ui#3557 Fixes angular-ui#4321 Fixes angular-ui#4335
This is a rollup commit intended to address several issues around the positioning and parsing of attributes. - Fixes issue introduced under PR angular-ui#4311 where setting height and width in tooltip position function messed up arrow placement. - Fixes issue introduced under PR angular-ui#4363 where setting visibility to hidden in tooltip position function caused elements in popover to lose focus. - Fixes issue angular-ui#1780 where tooltip would render if content was just whitespace. - Fixes issue angular-ui#3347 where tooltip isolate scope was being accessed after it was set to null. Observers will now be created/destroyed as tooltip opens/closes which will also offer a performance improvement. - Fixes issue angular-ui#3557 by implementing evalAsync to set tooltip scope isOpen property. - Fixes issue angular-ui#4335 where if model isOpen property is undefined, tooltip would call show/hide toggle function. - Closes PR angular-ui#4429 where how the templated content was being evaluated could cause an infinite digest loop. Closes angular-ui#4400 Closes angular-ui#4418 Closes angular-ui#4429 Closes angular-ui#4431 Closes angular-ui#4455 Fixes angular-ui#1780 Fixes angular-ui#3347 Fixes angular-ui#3557 Fixes angular-ui#4321 Fixes angular-ui#4335
isOpen
to boolean to do a proper comparison for firingtoggleTooltipBind
Here is the fix in action.
This fixes #4335.