Commit graph

2021 commits

Author SHA1 Message Date
Matthew Kleiman
6972596ce9 docs(ngRoute): add angularEvent param to $routeChangeStart event
Adds missing implied first argument, `angularEvent`, to match
the rest of the `$routeChange` event documentation.
2013-10-01 14:36:54 -07:00
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
f316c314ca refactor($ngAnimate): simplify the animation event rewrite
To avoid code duplication, use single variables for keeping
properties/events names to use. Also, fix some errors that have
happened after the rewrite from moment ago.
2013-10-01 10:00:35 -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
Stefan hr Berder
587e8e2ba5 refactor(select): simplify the ngOptions regular expression
\w matches [a-zA-Z0-9_] and \d matches [0-9], using both in a character set is
simply redundant.

Closes #3903
2013-10-01 10:06:15 +01:00
Chirayu Krishnappa
93ce5923e9 feat($sce): simpler patterns for $sceDelegateProviders white/blacklists
Closes #4006
2013-10-01 00:41:07 -07:00
Caitlin Potter
ba38de2212 docs($injector): Reword fn param docs and link to DI information 2013-09-30 17:26:00 -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
Uri Goldshtein
fc05f5e701 docs(angular.copy): add an example with the two possible arguments
Closes #4179
2013-09-30 22:15:57 +01:00
Fred Sauer
06a611c4b4 docs($route): reloadOnSearch affects hash fragment changes
reloadOnSearch also affects reloads due to $location.hash() changes
2013-09-30 14:04:59 -07:00
Martin Cortez
0868a076e0 docs($http): update grammar in comments
Closes #4186
2013-09-30 21:44:35 +01:00
Jeff Cross
2ebf931630 fix($location): re-assign location after BFCache back
In the Android browser, the BFCache maintains
the state of JavaScript applications even when
navigating to another app, so that going
forward and back, to and from an application
is very fast.

Unfortunately, this can have undesired side
effects. In this instance, the location
variable was holding a reference to a stale
window.location, and was throwing errors
when going back to an Angular app after
browsing to another site.

This fix makes sure that location.url()
includes a check to make sure that location
is referencing the current window.location.

Closes #4044
2013-09-30 13:02:40 -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
Rob Culliton
1618adfab1 docs(mocks): fix syntax error in example
Closes #4183
2013-09-28 20:23:18 +01:00
Uri Goldshtein
e2efa23015 docs($timeout): add a $timeout example
The original example is by gxlcl.

Closes #4180
2013-09-28 15:24:35 +01:00
Colin Casey
4ff1a65031 fix(log): prevent logging undefined for $log in IE
Closes #1705
2013-09-27 16:44:21 -07:00
David Bennett
5bb9ba2c54 docs(angular.Module): fix controller and directive method parameters 2013-09-27 16:10:43 -07:00
Dave Peticolas
e5eeb2e825 docs(ngIf): formatting, clarity 2013-09-27 15:49:05 -07:00
Igor Minar
f2160a4c64 style($rootScope): fix argument name in $postDigest api 2013-09-27 15:12:39 -07:00
Dave Peticolas
4998d3ee79 docs(ngController): fix grammar 2013-09-27 13:20:40 -07:00
Dave Peticolas
15fa29fb4b docs(ngCsp): fix grammar 2013-09-27 13:13:34 -07:00
Dave Peticolas
b891c708cf docs(dblClick): fix grammar 2013-09-27 13:04:42 -07:00
Dave Peticolas
2361572012 docs(ngDisabled): clarify 2013-09-27 13:01:35 -07:00
Igor Minar
7c38b292f8 style($compile): remove unused variable 2013-09-27 12:51:45 -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
Ben McCann
147c6929a2 feat(ngEventDirectives): add ngCopy, ngCut, and ngPaste
Closes #4172, #4170
2013-09-26 22:09:34 +01: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
Matias Niemelä
acc2fb8486 feat(browserTrigger): allow support for custom timeStamps in events 2013-09-26 11:19:43 -07:00
Brian Ford
e0c134b8bf fix($compile): work around issue in jQuery 1.10.2
jQuery 1.10.2 does not attach data to comment nodes, which previously broke `$compile`.
This changes how elements with "transclude element" and a controller are compiled to
avoid the issue.

Closes #3764
2013-09-25 17:25:00 -07:00
Dave Peticolas
12ae60052f docs(ngHref): fix formatting and clarify
Closes #4106
2013-09-25 22:33:07 +01:00
lorint
eb5b422842 docs(jqLite): fix typo
Closes #4105
2013-09-25 22:31:04 +01:00
Mr.Raindrop
01fdf683cf docs($http): fix adding default header to get request example
Initially, `$httpProvider.defaults.headers.get` is `undefined`, so
`$httpProvider.defaults.headers.get['My-Header']='value'` will throw an
error.

Closes #4101
2013-09-25 22:23:16 +01:00
Dave Peticolas
50194147ac docs(ngShowHide): improve clarity
Closes #4099
2013-09-25 22:16:11 +01: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
Pete Bacon Darwin
f8f8f754b0 fix(ngScenario): fix error message description 2013-09-25 09:46:32 +01:00
Boris Serdyuk
6c59e77008 refactor(angular.toJson): use charAt instead of regexp
Provides a performance improvement when serializing to JSON strings.

Closes #4093
2013-09-23 11:16:16 +01: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
Chirayu Krishnappa
3ed094d142 chore(sce): remove unused function 2013-09-20 15:41:57 -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
Dave Peticolas
88317a2888 docs(ngClass): fix grammar
Closes #4061
2013-09-20 20:47:13 +01:00
Dave Peticolas
602e226d36 docs(ngCloak): fix grammar, clarity
Closes #4076
2013-09-20 20:45:19 +01:00
Pete Bacon Darwin
f12c61e984 docs(ngModelController): clarify issue with isolated scope directive
See #4043
2013-09-19 21:08:37 +01:00
ts-web
72ad746b85 docs(input): fix spelling error and reword for clarity 2013-09-19 20:27:59 +01:00