-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Don't call $window.getComputedStyle on non-element #2405
Conversation
Cloud be related to #2400 |
Ah yes, that's the one (I'm on a different machine with a different version of FF at the moment, so couldn't reproduce the exact error) |
|
@ksperling - Thanks for providing this bug fix. Can you take a look at the check-list above and address those items that have not been ticked? |
It throws an exception at least in some versions of FF, and is declared as taking only an Element and not an arbitrary Node in the W3C spec. One place where this can happen easily is with ng-view if the template contains more than just a single top-level node (even just a trailing newline can trigger the problem). Also short-circuit the case where getComputedStyle doesn't return anything.
I've just signed the CLA (Karsten Sperling). Writing an e2e test that fails before this change and passes with it sounds rather complicated, is that really warranted for a tiny fix like this? |
Nice one Karsten! Thanks. It would be really great to get a failing unit test in before merging. A strategy could be to apply a Jasmine spy to the getComputedStyle function and check that it is not called if a non-element is passed to animator. |
Hey @petebacondarwin any chance you can also look into this (#2381) one? It's related code wise so I wonder if I should go ahead and rebase against this PR. |
@ksperling - I tried a test like this but this actually blows up before it even gets to the call to getComputedStyle as it tries to call
|
It seems that this was fixed at 9956bae#L0R278 |
This throws an exception at least in some versions of FF, and is declared
as taking only an Element and not an arbitrary Node in the W3C spec.
One place where this can happen easily is with ng-view if the template
contains more than just a single top-level node (even just a trailing
newline can trigger the problem).
Also short-circuit the case where getComputedStyle doesn't return anything.