Commit graph

1364 commits

Author SHA1 Message Date
Ricardo Bin
e9a222418a fix($httpBackend): set headers with falsy values
This is a breaking change. To migrate to the new behavior,
delete or set headers to `undefined` to avoid having them sent.
To restore the old behavior, override `$httpBackendProvider`
with the old implementation.

Closes #2984
2013-10-01 14:02:00 -07:00
Matias Niemelä
2a63dfa6cc fix($animator): avoid completing the animation asynchronously unless CSS transtiions/animations are present
Closes #4023
Closes #3940
2013-10-01 15:00:16 -04:00
James Roper
0d0330adc2 fix($httpBackend): don't send empty string bodies
The `XMLHttpRequest.send` spec defines different semantics for `null`
than for an empty String: an empty String should be sent with a
`Content-Type` of `text/plain`, whereas `null` should have no
`Content-Type` header set.

Closes #2149
2013-10-01 11:28:21 -07:00
jquadrin
0ca5426184 chore: remove Firefox CORS workaround
See #1468
2013-10-01 10:26:08 -07:00
Henning Teek
025c921903 fix(dateFilter): allow negative millisecond value strings 2013-10-01 10:18:03 -07:00
Michał Gołębiowski
ac2d06b19d chore($ngAnimate): simplify vendor prefixes handling in tests 2013-10-01 10:00:43 -04:00
Colin Casey
4033cf2814 feat(filter): allow map of filters to be registered
This feature adds similar functionality to what `$ControllerProvider.register`
and `$CompileProvider.directive` currently provide by allowing a map of filter
name/factories to be passed as the sole argument to `$FilterProvider.register`
to register all of the specified filters.

Closes #4036
Closes #4091
2013-10-01 10:26:36 +01:00
Chirayu Krishnappa
93ce5923e9 feat($sce): simpler patterns for $sceDelegateProviders white/blacklists
Closes #4006
2013-10-01 00:41:07 -07:00
jankuca
5a1a6b86a8 fix(ngTransclude): detect ngTranslude usage without a transclusion directive
Closes #3759
2013-09-30 16:44:19 -07:00
Vojta Jina
742271ffa3 fix($compile): link parents before traversing
How did compiling a templateUrl (async) directive with `replace:true` work before this commit?
1/ apply all directives with higher priority than the templateUrl directive
2/ partially apply the templateUrl directive (create `beforeTemplateNodeLinkFn`)
3/ fetch the template
4/ apply second part of the templateUrl directive on the fetched template
(`afterTemplateNodeLinkFn`)

That is, the templateUrl directive is basically split into two parts (two `nodeLinkFn` functions),
which has to be both applied.

Normally we compose linking functions (`nodeLinkFn`) using continuation - calling the linking
function of a parent element, passing the linking function of the child elements as an argument. The
parent linking function then does:
1/ execute its pre-link functions
2/ call the child elements linking function (traverse)
3/ execute its post-link functions

Now, we have two linking functions for the same DOM element level (because the templateUrl directive
has been split).

There has been multiple issues because of the order of these two linking functions (creating
controller before setting up scope locals, running linking functions before instantiating
controller, etc.). It is easy to fix one use case, but it breaks some other use case. It is hard to
decide what is the "correct" order of these two linking functions as they are essentially on the
same level.

Running them side-by-side screws up pre/post linking functions for the high priority directives
(those executed before the templateUrl directive). It runs post-linking functions before traversing:
```js
beforeTemplateNodeLinkFn(null); // do not travers
afterTemplateNodeLinkFn(afterTemplateChildLinkFn);
```

Composing them (in any order) screws up the order of post-linking functions. We could fix this by
having post-linking functions to execute in reverse order (from the lowest priority to the highest)
which might actually make a sense.

**My solution is to remove this splitting.** This commit removes the `beforeTemplateNodeLinkFn`. The
first run (before we have the template) only schedules fetching the template. The rest (creating
scope locals, instantiating a controller, linking functions, etc) is done when processing the
directive again (in the context of the already fetched template; this is the cloned
`derivedSyncDirective`).

We still need to pass-through the linking functions of the higher priority directives (those
executed before the templateUrl directive), that's why I added `preLinkFns` and `postLinkFns`
arguments to `applyDirectivesToNode`.

This also changes the "$compile transclude should make the result of a transclusion available to the
parent directive in post- linking phase (templateUrl)" unit test. It was testing that a parent
directive can see the content of transclusion in its pre-link function. That is IMHO wrong (as the
`ngTransclude` directive inserts the translusion in its linking function). This test was only passing because of
c173ca4128, which changed the behavior of the compiler to traverse
before executing the parent linking function. That was wrong and also caused the #3792 issue, which
this change fixes.

Closes #3792
Closes #3923
Closes #3935
Closes #3927
2013-09-30 15:30:29 -07:00
Matias Niemelä
2df3c9f58d fix($animate): ensure transition-property is not changed when only keyframe animations are in use
Closes #3933
2013-09-30 10:59:28 -07:00
Colin Casey
4ff1a65031 fix(log): prevent logging undefined for $log in IE
Closes #1705
2013-09-27 16:44:21 -07:00
Brian Ford
c785267eb8 fix(jqLite): use get/setAttribute so that jqLite works on SVG nodes
jqLite previously used `elt.className` to add and remove classes from a DOM Node, but
because the className property is not writable on SVG elements, it doesn't work with
them. This patch replaces accesses to `className` with `get/setAttribute`.

`classList` was also considered as a solution, but because only IE10+ supports it, we
have to wait. :'(

The JqLiteAddClass/JQLiteRemoveClass methods are now also used directly by $animate
to work around the jQuery not being able to handle class modifications on SVG elements.

Closes #3858
2013-09-27 12:38:27 -07:00
jankuca
6a8edc1d43 fix($compile): collect ranges on multiple directives on one element
The problem was in keeping the values of `attrNameStart` and `attrNameEnd` between directive loop iterations which lead to the compiler looking for multi-element ranges for any directives that happened to be in the directive list after one that was applied on a range. For instance, having a ng-repeat-start and ng-class on a single element with ng-repeat being resolved first made the compiler look for an ng-repeat-end for both ng-repeat and ng-class because the `attrNameEnd` was not reset to a falsy value before the second iteration. As the result, an exception saying the block end element could not be found and the second directive was not actually applied.

Closes #4002
2013-09-26 15:01:35 -07:00
Matias Niemelä
0a63adce68 fix(ngAnimate): ensure that delays are always considered before an animation closes
Closes #4028
2013-09-26 11:19:43 -07:00
jankuca
31c56f5400 fix(ngRepeat): correctly track elements even when the collection is initially undefined
Previously if the collection model was set to undefined on the first digest,
the repeater would get confused and not use the correct tracking function
for associating model with dom elements in the repeater.

Closes #4145
Closes #3964
2013-09-25 09:42:01 -07:00
Chirayu Krishnappa
e2751292da test(ng-non-bindable): test sibling bindings
Ref: https://github.com/angular/angular.dart/blob/master/test/directives/ng_non_bindable_spec.dart
2013-09-20 23:55:23 -07:00
Chirayu Krishnappa
e2068ad426 fix(ng-bind-html): watch string value instead of wrapper
Ref: https://github.com/angular/angular.js/pull/4045

I have this sinking feeling that support this use case sort of
encourages binding to function that blindly trust some html.  For now,
I'm fixing the issue while I think about the use cases some more.

In the case of a function that performs any non-trivial work before
wrapping the value (e.g. the showdown filter in issue #3980, or the
binding to a simply wrapper function in issue #3932 if it did anything
meaty), this fix makes it "work" - but performance is going to suck -
you should bind to some other thing on scope that watches the actual
source and adjusts itself when that changes (e.g. the showdown filter.)
For the case of the wrapper in #3932, if one isn't performing
sanitization or some such thing - then you the developer has insight
into why that value is safe in that particular context - and it should
be available simply by name and not as a result of a function taking any
arbitrary input to make auditing of security a little saner.

Closes #3932, #3980
2013-09-20 16:30:20 -07:00
Brian Ford
5eb1fb6cb2 fix(ngInclude): don't break attribute bindings on ngInclude-ed element
BREAKING CHANGE: ngInclude's priority is now set to 1000

It's quite rare for anyone to depend on explicity directive priority,
but if a custom directive that needs to run before ngInclude exists,
it should have its priority checked and adjusted if needed.

Closes #3793
2013-09-20 14:11:12 -07:00
Igor Minar
255e8c13cf fix(ngView): IE8 regression due to expando on non-element nodes
This fixes the "TypeError: Object doesn't support this property or method" error on IE8,
when view templates contain leading white-space.

Closes #3971
2013-09-20 13:55:16 -07:00
Chirayu Krishnappa
be0b485669 fix($parse): disallow access to window and dom in expressions 2013-09-17 18:15:49 -07:00
Chirayu Krishnappa
4b71bbc988 fix(test): fixed toThrow usage 2013-09-17 16:13:25 -07:00
Gowtam Lal
aa3c54c73f fix(ngOptions): ignore object properties which start with $ 2013-09-13 12:48:19 +01:00
Woody Peterson
64e7b7774e test($browser): correct false positive in ApplicationSpec.js
Previously, the check that Application should return a new $window and
$document had the arguments reversed in the first call to navigateTo;
thus, the subsequent check of inequality of $window and $document in the
next navigateTo call would always pass.

This corrects the argument order, which makes this test not succeptible
to false positives.
2013-09-11 22:19:24 +01:00
R. Merkert
21e9e8cf68 fix(ngSanitize): sanitizer should not accept <!--> as a valid comment
According to http://validator.w3.org/ , <!--> is not a valid comment
and neither is any comment containing the -- substring.
2013-09-11 22:40:09 +02:00
Matias Niemelä
d50ed6bfb8 fix(ngAnimate): check elapsedTime on current event
onAnimationProgress now checks the event's elapsedTime property before
checking the originalEvent.elapsedTime property.
Use browserTrigger with elapsedTime parameter to trigger animation events
2013-09-06 22:19:53 +01:00
Matias Niemelä
28f56a383e fix(ngScenario): provide event parameters as object
BREAKING CHANGE: browserTrigger now uses an eventData object instead of direct parameters for mouse events.
To migrate, place the `keys`,`x` and `y` parameters inside of an object and place that as the third parameter
for the browserTrigger function.
2013-09-06 17:00:37 -04:00
Matias Niemelä
32ad292611 refactor($animate): use CSS3 transition/animation events instead of $timeouts to track ongoing animations
Closes #3629
Closes #3874
2013-09-05 17:20:28 -04:00
Matias Niemelä
40c0220c47 fix(ngView): ensure ngClass works with together with ngView's transclusion behavior
Closes: #3727
2013-09-03 17:06:49 -07:00
Matias Niemelä
36ad40b18c fix(ngAnimate): ensure that ngClass is always compiled before enter, leave and move animations
Closes #3727
Closes #3603
2013-09-03 17:06:49 -07:00
Matias Niemelä
4e15c4fb47 chore($rootScope): provide support to execute a function after the digest cycle is complete 2013-09-03 17:06:49 -07:00
Matias Niemelä
4382df03fa fix(ngAnimate): cut down on extra $timeout calls 2013-09-03 17:06:49 -07:00
Merrick Christensen
f737c97df0 feat(ngMock): allow passing an object literal as shorthand to module 2013-09-03 14:22:12 -07:00
jankuca
8e48c4ff6a fix($http): allow empty responses to be cached
Closes #3809
2013-09-02 11:47:51 +02:00
Chirayu Krishnappa
427ee93f11 fix(core): parse IE11 UA string correctly
It's great that IE11 wants to be compatible enough that it doesn't want
to be special cased and treated differently.

However, as long as one has to have a different code path for IE than
for the other supported browsers, we still need to detect and special
case it.  For instance, our URL parsing code still needs the same
workaround the we used for IE10.  We still see the same Access denied /
TypeError exceptions when setting certain values.  FYI, Angular doesn't
generally blindly test for IE – we also check the version number.

Thanks to modern.ie for the free IE11 test VM.

Closes #3682
2013-08-29 16:07:49 -07:00
Igor Minar
e86de0db56 test(Scope): fix tests after reverting commits
Making assertions on state (rather than interactions) is better anyway.
2013-08-27 22:36:23 -07:00
Igor Minar
4114f9c21b revert: feat(mocks): make $timeout#flush throw an exception when empty
This reverts commit cbf06a5d64.

This turned out to be a bad idea because it allow us to fast-forward
the wall clock time (see previous commit).
2013-08-27 17:23:36 -07:00
Igor Minar
70b44ad32a revert: fix(mocks): $timeout#flush should not update time when empty
This reverts commit 42af8eada2.

This turned out to be a bad idea as it prevents us from moving the
time forward and asserting that the component state didn't change
due to the scheduled task executing too early.
2013-08-27 17:21:11 -07:00
Igor Minar
6b91aa0a18 feat(Scope): async auto-flush $evalAsync queue when outside of $digest
This change causes a new $digest to be scheduled in the next tick if
a task was was sent to the $evalAsync queue from outside of a $digest
or an $apply.

While this mode of operation is not common for most of the user code,
this change means that $q promises that utilze $evalAsync queue to
guarantee asynchronicity of promise apis will now also resolve outside
of a $digest, which turned out to be a big pain point for some developers.

The implementation ensures that we don't do more work than needed and
that we coalese as much work as possible into a single $digest.

The use of $browser instead of setTimeout ensures that we can mock out
and control the scheduling of "auto-flush", which should in theory
allow all of the existing code and tests to work without negative
side-effects.

Closes #3539
Closes #2438
2013-08-26 09:06:25 -07:00
Igor Minar
42af8eada2 fix(mocks): $timeout#flush should not update time when empty
When $timeout#flush is called with a delay and no task can be flushed within that
delay, the current time should not be updated as that gets the mock into an inconsistent
state.

BREAKING CHANGE: if a tests was written around the buggy behavior the delays might be off now

This would typically not be a problem, but because of the previous breaking change in
$timeout.flush, the combination of two might be confusing and that's why we are documenting
it.

Old behavior:

```
doSomething(); //schedules task to execute in 500ms from now
doOtherStuff(); //schedules task to execute in 600ms from now

try {
  $timeout.flush(300); // throws "no task to be flushed" exception
} catch(e) {};
$time.flush(200); //flushes only doSomething() task
```

New behavior:

```
doSomething(); //schedules task to execute in 500ms from now
doOtherStuff(); //schedules task to execute in 600ms from now

try {
  $timeout.flush(300); // throws "no task to be flushed" exception
} catch(e) {};
$time.flush(200); // throws "no task to be flushed" exception again
                  // because previous exception didn't move the time forward
```

Fixed test:

```
doSomething(); //schedules task to execute in 500ms from now
doOtherStuff(); //schedules task to execute in 600ms from now

try {
  $timeout.flush(300); // throws "no task to be flushed" exception
} catch(e) {};
$time.flush(500); // flushes only doSomething() task
```
2013-08-25 14:46:55 -07:00
Igor Minar
cbf06a5d64 feat(mocks): make $timeout#flush throw an exception when empty
When calling $timeout.flush with or without a delay an exception should
be thrown if there is nothing to be flushed.

This prevents tests from flushing stuff unnecessarily.

BREAKING CHANGE: calling $timeout.flush(delay) when there is no task to be flushed
within the delay throws an exception now.

Please adjust the delay or remove the flush call from your tests as the exception
is a signed of a programming error.
2013-08-25 14:46:54 -07:00
Igor Minar
92700509c8 test(docs): disable brittle tests that need to be rewritten 2013-08-25 14:46:54 -07:00
Igor Minar
9b94169aaa style(animateSpec): remove ws 2013-08-25 14:46:54 -07:00
Igor Minar
5d9f42050a fix($q): reject should catch & forward exceptions thrown in errback 2013-08-24 12:49:46 -07:00
Igor Minar
1d06a94385 chore: reorganize test helper files under test/helpers 2013-08-23 15:46:11 -07:00
Matias Niemelä
7c605ddf1c fix($animate): skip ngAnimate animations if the provided element already has transitions/durations attached to it
Closes #3587
2013-08-23 14:04:35 -07:00
Matias Niemelä
ee2f3d21da fix($animate): only execute a timeout when transitions or keyframe animations are used
ngAnimate causes a 1ms flicker on the screen when no CSS animations are present on the element.
The solution is to change $animate to only use $timeouts when a duration is found on the element
before the transition/keyframe animation takes over.

Closes #3613
2013-08-23 14:04:35 -07:00
Matias Niemelä
fb3a7db080 feat(ngMock): add support for creating dynamic style sheets within test code 2013-08-23 14:04:35 -07:00
Vojta Jina
b89a4e49b9 test: rename / remove duplicate unit tests 2013-08-23 12:43:42 -07:00
Dusan Bartos
eefcdad013 fix($sniffer): history problems on Boxee box
History API not working properly on Boxee box browser (old Webkit)
problem similar to the one on Android < 4
2013-08-23 11:57:55 -07:00