1626 Commits

Author SHA1 Message Date
Caitlin Potter
ad128e09ff test($rootScope): add assertion to test ensuring that NaN -> NaN does not throw
fb6062fb9d implements a
fix for NaN values causing $watchCollection to throw an infdig error. This change updates the test
by adding an assertion which explains what is actually being tested a bit better, and may also
provide better information in the event that the test ever fails.

Closes #6758
2014-03-21 13:05:29 -07:00
Sekib Omazic
e48c28fe92 fix($rootScope): ng-repeat can't handle NaN values. #4605
$watchCollection checks if oldValue !== newValue which does not work for NaN. This was causing
infinite digest errors, since comparing NaN to NaN in $watchCollection would always return false,
indicating that a change was occuring on each loop.

This fix adds a simple check to see if the current value and previous value are both NaN, and
if so, does not count it as a change.

Closes #4605
2014-03-21 13:05:29 -07:00
Caitlin Potter
10d3e1e447 fix(orderBy): support string predicates containing non-ident characters
The orderBy filter now allows string predicates passed to the orderBy filter to make use property
name predicates containing non-ident strings, such as spaces or percent signs, or non-latin
characters.

This behaviour requires the predicate string to be double-quoted.

In markup, this might look like so:

```html
<div ng-repeat="item in items | orderBy:'\"Tip %\"'">
...
</div>
```

Or in JS:

```js
var sorted = $filter('orderBy')(array, ['"Tip %"', '-"Subtotal $"'], false);
```

Closes #6143
Closes #6144
2014-03-21 13:05:29 -07:00
Caitlin Potter
93d1c95c61 fix(ngCookie): convert non-string values to string
Previously, non-string values stored in $cookies would be removed, without warning the user, and
causing difficulty debugging. Now, the value is converted to string before being stored, and the
value is not dropped. Serialization may be customized using the toString() method of an object's
prototype.

Closes #6151
Closes #6220
2014-03-21 13:05:29 -07:00
Chris Constantin
01a34f513b fix(ngTouch): update workaround for desktop Webkit quirk
Fix click busting of input click triggered by a label click quickly
following a touch event on a different element, in desktop
and mobile WebKit

To reproduce the issue fixed by this commit set up a page with
 - an element with ng-click
 - a radio button (with hg-model) and associated label
In a quick sequence tap on the element and then on the label.
The radio button will not be checked, unless PREVENT_DURATION has passed

Closes #6302
2014-03-21 13:05:29 -07:00
Caitlin Potter
98d825e10d fix(jqLite): traverse host property for DocumentFragment in inheritedData()
If dealing with a document fragment node with a host element, and no parent, use the host
element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
to lookup parent controllers.

Closes #6637
2014-03-21 11:42:17 -07:00
Jeff Balboni
dc149de936 fix(select): avoid checking option element selected properties in render
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes #2448
Closes #5994
Closes #6769
2014-03-20 17:27:02 -04:00
Brett Porter
d4ac25496a test(ngMock): workaround issue with negative timestamps
In some specific timezones and operating systems, it seems that
getTimezoneOffset() can return an incorrect value for negative timestamps, as
described in #5017. While this isn't something easily fixed in the mock code,
the tests can avoid that particular timeframe by using a positive timestamp.

Closes #5017
Closes #6730
2014-03-18 21:31:20 -07:00
Traxmaxx
e84da2283c fix($$RAFProvider): check for webkitCancelRequestAnimationFrame
Android 4.3 only supports webkitCancelRequestAnimationFrame.

Closes #6526
2014-03-18 21:38:20 -04:00
Igor Minar
3dd9572754 fix(Scope): $watchCollection should call listener with oldValue
Originally we destroyed the oldValue by incrementaly copying over portions of the newValue
into the oldValue during dirty-checking, this resulted in oldValue to be equal to newValue
by the time we called the watchCollection listener.

The fix creates a copy of the newValue each time a change is detected and then uses that
copy *the next time* a change is detected.

To make `$watchCollection` behave the same way as `$watch`, during the first iteration
the listener is called with newValue and oldValue being identical.

Since many of the corner-cases are already covered by existing tests, I refactored the
test logging to include oldValue and made the tests more readable.

Closes #2621
Closes #5661
Closes #5688
Closes #6736
2014-03-18 12:01:42 -07:00
Igor Minar
922cb7e42f chore(log): add log.empty() method to the testing logger
`log.empty()` is the same as `log.reset()`, except thati `empty()`  also returns the current array with messages

instead of:

```
// do work
expect(log).toEqual(['bar']);
log.reset();
```

do:

```
// do work
expect(log.empty()).toEqual(['bar']);
```
2014-03-18 12:01:35 -07:00
Bruno Baia
fbb125a3af fix($http): allow sending Blob data using $http
Closes #5012
2014-03-16 09:52:44 -07:00
Pawel Kozlowski
f108a2a994 fix($http): don't covert 0 status codes to 404 for non-file protocols
PR #5547 introduced conversion of all 0 status codes to 404 for cases
where no response was recieved (previously this was done for the
file:// protocol only). But this mechanism is too eager and
masks legitimate cases where status 0 should be returned. This commits
reverts to the previous mechanism of handling 0 status code for the
file:// protocol (converting 0 to 404) while retaining the returned
status code 0 for all the protocols other than file://

Fixes #6074
Fixes #6155
2014-03-14 13:45:07 -07:00
Matias Niemelä
ee8e4a946e fix($$rAF): always fallback to a $timeout incase native rAF isn't supported
Closes #6654
2014-03-14 13:48:37 -04:00
Tomer Chachamu
a41a2a1d2c fix(ngAnimate): setting classNameFilter disables animation inside ng-if
Closes #6539
2014-03-14 13:48:29 -04:00
Lucas Galfasó
ca0ac64997 fix($compile): support templates with thead and tfoot root elements
If the first element in a template is a <thead> or a <tfoot>, then
use the existing logic to handle table elements compilation.

Closes #6289
2014-03-07 15:09:16 -08:00
Timothée Jeannin
8c7b9b8de4 style: enable jscs requireLeftStickedOperators rule
Closed #6544.
2014-03-07 15:05:22 -08:00
Matias Niemelä
18c41af065 fix($animate): delegate down to addClass/removeClass if setClass is not found
Closes #6463
2014-02-28 01:34:57 -05:00
Yves Brissaud
33443966c8 feat($animate): animate dirty, pristine, valid, invalid for form/fields
Add css animations when form or field status change to/from dirty,
pristine, valid or invalid. This works like animation system present
with ngClass, ngShow, etc.

Closes #5378
2014-02-28 01:01:34 -05:00
Pawel Kozlowski
4e73c80b17 fix(jqLite): properly toggle multiple classes
Fixes #4467
Closes #6448
2014-02-27 19:44:57 +01:00
Lajos Veres
27873acbf0 chore(qSpec): fix typos 2014-02-27 01:54:06 -08:00
Lajos Veres
4f48898728 chore(parseSpec): fix typo 2014-02-27 01:53:35 -08:00
Lajos Veres
0df6e20e6a chore(httpSpec): fix typo 2014-02-27 01:53:13 -08:00
Lajos Veres
074ad03072 chore(filtersSpec): fix typo 2014-02-27 01:52:51 -08:00
Lajos Veres
a20e76ea80 chore(ngRepeatSpec): fix typo 2014-02-27 01:52:21 -08:00
Lajos Veres
d59678a080 chore(AngularSpec): fix typo 2014-02-27 01:51:45 -08:00
Matias Niemelä
f4f1f43d51 fix($animate): ensure all comment nodes are removed during a leave animation
Closes #6403
2014-02-26 17:17:41 -05:00
Matias Niemelä
e71e7b6cae fix($animate): only block keyframes if a stagger is set to occur
Transitions must be blocked so that the initial CSS class can be applied
without triggering an animation. Keyframes do not need to be blocked since
animations are always triggered on the starting CSS class, however, if a
stagger animation is set to occur then all elements for index > 0 should
be blocked. This is to prevent the animation from occuring early on before
the stagger delay for the given element has passed.

With ngAnimate and keyframe animations, IE10 and Safari will render a slight
flicker effect caused by the blocking. This fix resolves this issue.

Closes #4225
2014-02-26 17:08:51 -05:00
Stanislav Sysoev
c914cd99b3 fix(ngAnimate): TypeError Cannot call method 'querySelectorAll' in cancelChildAnimations
When an element containing both ng-repeat and ng-if directives attempts to remove any items from
the repeat collection, the following error is thrown: "TypeError Cannot call method 'querySelectorAll'
of undefined".  This happens because the cancelChildAnimations code naively belives that the jqLite
object always has an element node within it. The fix in this commit addresses to securely check to see
if a node was properly extracted before any child elements are inspected.

Closes #6205
2014-02-26 15:39:54 -05:00
Matias Niemelä
e9881991ca fix($animate): ensure that animateable directives cancel expired leave animations
If enter -> leave -> enter -> leave occurs then the first leave animation will
animate alongside the second. This causes the very first DOM node (the view in ngView
for example) to animate at the same time as the most recent DOM node which ends
up being an undesired effect. This fix takes care of this issue.

Closes #5886
2014-02-26 14:53:57 -05:00
Matias Niemelä
c9245cf759 test($animate): ensure staggering timeout tests are secure 2014-02-26 14:23:56 -05:00
Matias Niemelä
99720fb5ab fix($animate): ensure all animated elements are taken care of during the closing timeout
Closes #6395
2014-02-26 14:23:47 -05:00
Igor Minar
3d6dff44f3 revert: fix($location): parse query string when path is empty in hashbang mode
This reverts commit cad717b117.

This change causes regressions in existing code and after closer inspection
I realized that it is trying to fix an issue that is should not be considered
a valid issue.

The location service was designed to work against either "hash" part of the
window.location when in the hashbang mode or full url when in the html5 mode.

This change tries to merge the two modes partially, which is not right. One
reason for this is that the search part of window.location can't be modified
while in the hashbang mode (a browser limitation), so with this change part
of the search object should be immutable and read-only which will only cause
more confusion.

Relates to #5964
2014-02-25 22:59:31 -08:00
Michał Gołębiowski
6b049c74cc feat($parse): support trailing commas in object & array literals
Per ECMAScript 5.1 specification trailing commas are allowed in object and
array literals. All modern browsers as well as IE>8 support this syntax.
This commit adds support for such syntax to Angular expressions.
2014-02-26 00:38:37 +01:00
Matias Niemelä
4c4537e65e perf($animate): use rAF instead of timeouts to issue animation callbacks 2014-02-24 21:23:18 -05:00
Matias Niemelä
62761428ef chore(core): create a wrapper to manage async callbacks 2014-02-24 21:23:10 -05:00
Matias Niemelä
04d7317cdd chore(core): introduce a wrapper for requestAnimationFrame 2014-02-24 21:23:05 -05:00
Chia-liang Kao
ffe5115355 style(tests): remove trailing comma in specs
Closes #6241
2014-02-22 22:41:51 +01:00
Caitlin Potter
cad717b117 fix($location): parse query string when path is empty in hashbang mode
Before this fix, search queries in hashbang mode were ignored if the hash was not present in the
url. This patch corrects this by ensuring that the search query is available to be parsed by
urlResolve when the hashbang is not present.

Closes #5964
2014-02-21 18:31:13 -05:00
Caitlin Potter
75515852ea fix(isElement): reduce false-positives in isElement tests
Complimentary change to match changed $parse behaviour.
2014-02-21 17:59:01 -05:00
Caitlin Potter
5fe1f39f02 fix($parse): reduce false-positives in isElement tests
There are always going to be false positives here, unfortunately. But
testing different properties will hopefully reduce the number of false
positives in a meaningful way, without harming performance too much.

Closes #4805
Closes #5675
2014-02-21 17:58:48 -05:00
Caitlin Potter
2bce71e9dc feat(ngHref): bind ng-href to xlink:href for SVGAElement
This change makes the ngHref directive useful for SVGAElements by having it bind
to the xlink:href attribute rather than the href attribute.

Closes #5904
2014-02-21 17:56:48 -05:00
Boris Serdyuk
c8e03e34b2 fix($http): do not add trailing question
Closes #6342
2014-02-21 14:51:10 -08:00
Pawel Kozlowski
267b217376 fix($http): send GET requests by default
Fixes #5985
Closes #6401
2014-02-21 14:42:03 -08:00
Peter Bacon Darwin
d7a73e41ed chore(doc-gen): add formatted error messages to error pages
This got missed in the doc migration: When there is an error in an
Angular app, extra information is placed in the URL, which can be used
by the docs application to display a more useful message.

This fix adds that back in.  The error message templates are extracted
by the minerr tool during build and put into the errors.json file. The
errors-doc processor will load this up and attach these message templates
to the error docs.

The display of these templates was already in place, via the errorDisplay
directive in docs/app/js/errors.js.

(Also, moved the error.template.html file into the angular.js repository
from the dgeni-packages repository as this is specific to the angular.js
project and all the other error related stuff is in here.

Finally, also, added an e2e test that checks that minerr formatted
messages are displayed correctly.

Closes #6363
2014-02-20 14:41:32 +00:00
Caitlin Potter
868a2c401f style(jqLite): remove trailing whitespace in new test
Oops.
2014-02-18 18:52:09 -05:00
Caitlin Potter
05fbed5710 fix(jqLite): make jqLite('<iframe src="someurl">').contents() return iframe document, as in jQuery
This is a very tiny change to make behaviour consistent with jQuery.

Closes #6320
Closes #6323
2014-02-18 18:43:59 -05:00
Igor Minar
481508d0e7 style: remove ws and enfore no-trailing-ws jscs rule 2014-02-18 10:44:48 -08:00
Peter Bacon Darwin
4f937bda18 test(docs): add check for resilience to trailing slashes, etc. 2014-02-18 06:36:34 +00:00
Peter Bacon Darwin
9878fee299 test(docs-app-e2e): refactor test inline with new docs app
The links to code elements have now changed: api/ng.directive:ngClick ->
api/ng/directive/ngClick.

Examples now run inside iframes, so we need to instruct Protractor to
switch to the example iframe.
2014-02-16 19:03:43 +00:00