Commit Graph

3317 Commits

Author SHA1 Message Date
Tobias Bosch
a0bfdd0d60 fix(input): correctly handle invalid model values for input[date/time/…]
Similar to `input[number]` Angular will throw if the model value
for a `input[date]` is not a `Date` object.
For `Invalid Date`s (dates whose `getTime()` is `NaN`) `input[date]`
will render an empty string.

Closes #8949
Closes #9375
2014-10-01 16:12:05 -07:00
Igor Minar
3624e3800f fix(ngView): use animation promises ensure that only one leave animation occurs at a time
the tracking depended on a local flag variable, which was susceptible to corruption due to
race conditions.

using promises ensures that the previousLeaveAnimation is nulled out only if it hasn't been
canceled yet.

Closes #9355
Closes #7606
Closes #9374
2014-10-01 15:19:29 -07:00
Jason Bedard
b1ee5386d5 perf(ngForm,ngModel): move initial addClass to the compile phase
Closes #8268
2014-09-30 21:45:41 -07:00
ltrillaud
ab80cd9066 fix(compile): sanitize srcset attribute
Applies similar sanitization as is applie to img[src] to img[srcset],
while adapting to the different semantics and syntax of srcset.
2014-09-30 16:32:58 -07:00
Tobias Bosch
b9479ee73b chore(ngCsp): add e2e tests
Also changes `connect:devserver` and `connect:testserver` to conditionally serve files with csp headers when the path contains `.csp` somewhere.

Closes #9136
Closes #9059
2014-09-30 14:10:19 -07:00
thorn0
8b54524c07 docs($compile): fix a broken link 2014-09-30 12:33:01 -07:00
thorn0
b186709003 docs($compile): add header to example 2014-09-30 11:40:48 -07:00
Caitlin Potter
a27d827c22 fix($compile): get $$observe listeners array as own property
Prevent accidentally treating a builtin function from Object.prototype as the binding object, and thus
preventing the compiler from throwing when using attribute binding names which match a property of the
Object prototype.

Closes #9343
Closes #9345
2014-09-30 13:05:09 -04:00
Brian Ford
2bcd02dc1a fix(select): make ctrl.hasOption method consistent
Prior to this fix, options added to a select by ngOptions would not cause
`selectCtrl.hasOption` to return `true`

Closes #8761
2014-09-29 13:58:03 -07:00
Lucas Galfaso
6303c3dcf6 fix($compile): Resolve leak with asynchronous compilation
Stop an asynchronous compilation when this is performed on an
already destroyed scope

Closes #9199
Closes #9079
Closes #8504
Closes #9197
2014-09-29 12:47:21 +01:00
Lucas Galfaso
cd2cfafcab refactor($scope): prevent multiple calls to listener on $destroy
Prevent isolated scopes from having listeners that get called
multiple times when on `$destroy`
2014-09-29 12:41:36 +01:00
Jason Bedard
b119251827 perf($rootScope): moving internal queues out of the Scope instances
Closes #9071
2014-09-27 08:19:15 -07:00
Jason Bedard
5572b40b15 refactor($parse): change 'this' to a $parse keyword instead of scope field
BREAKING CHANGE:
- $scope['this'] no longer exits on the $scope object
- $parse-ed expressions no longer allow chaining 'this' such as this['this'] or $parent['this']
- 'this' in $parse-ed expressions can no longer be overriden, if a variable named 'this' is put on the scope it must be accessed using this['this']

Closes #9105
2014-09-27 08:13:14 -07:00
Peter Bacon Darwin
fb0c77f0b6 fix($compile): connect transclude scopes to their containing scope to prevent memory leaks
Transcluded scopes are now connected to the scope in which they are created
via their `$parent` property. This means that they will be automatically destroyed
when their "containing" scope is destroyed, without having to resort to listening
for a `$destroy` event on various DOM elements or other scopes.

Previously, transclude scope not only inherited prototypically from the scope from
which they were transcluded but they were also still owned by that "outer" scope.
This meant that there were scenarios where the "real" container scope/element was
destroyed but the transclude scope was not, leading to memory leaks.

The original strategy for dealing with this was to attach a `$destroy` event handler
to the DOM elements in the transcluded content, so that if the elements were removed
from the DOM then their associated transcluded scope would be destroyed.

This didn't work for transclude contents that didn't contain any elements - most
importantly in the case of the transclude content containing an element transclude
directive at its root, since the compiler swaps out this element for a comment
before a destroy handler could be attached.

BREAKING CHANGE:

`$transclude` functions no longer attach `$destroy` event handlers to the
transcluded content, and so the associated transclude scope will not automatically
be destroyed if you remove a transcluded element from the DOM using direct DOM
manipulation such as the jquery `remove()` method.

If you want to explicitly remove DOM elements inside your directive that have
been compiled, and so potentially contain child (and transcluded) scopes, then
it is your responsibility to get hold of the scope and destroy it at the same time.

The suggested approach is to create a new child scope of your own around any DOM
elements that you wish to manipulate in this way and destroy those scopes if you
remove their contents - any child scopes will then be destroyed and cleaned up
automatically.

Note that all the built-in directives that manipulate the DOM (ngIf, ngRepeat,
ngSwitch, etc) already follow this best practice, so if you only use these for
manipulating the DOM then you do not have to worry about this change.

Closes #9095
Closes #9281
2014-09-26 21:38:17 +01:00
Peter Bacon Darwin
6417a3e9eb feat(Scope): allow the parent of a new scope to be specified on creation
This enables us to place transclude scopes more accurately in the scope hierarchy.
2014-09-26 21:38:02 +01:00
Caitlin Potter
07e3abc7dd feat($compile): optionally get controllers from ancestors only
Implement option to strengthen require '^' operator, by adding another '^'.

When a second '^' is used, the controller will only search parent nodes for the
matching controller, and will throw or return null if not found, depending on
whether or not the requirement is optional.

Closes #4518
Closes #4540
Closes #8240
Closes #8511
2014-09-26 16:32:26 -04:00
Michał Gołębiowski
8202c4dcea chore(Angular): drop support for Opera < 15
Closes #8589
2014-09-26 11:32:11 -07:00
Caitlin Potter
92f05e5a59 fix(ngModel): do not parse undefined viewValue when validating
Previously, if a viewValue had not yet been set on the element, it could incorrectly produce a
parse error.

This change prevents the parsers from running if a view value has not yet been committed.

Closes #9106
Closes #9260
2014-09-24 18:00:20 -04:00
Caitlin Potter
729c238e19 feat(input): support dynamic element validation
Interpolates the form and form control attribute name, so that dynamic form controls (such as those
rendered in an ngRepeat) will always have their expected interpolated name.

The control will be present in its parent form controller with the interpolated property name, and
this name can change when the interpolated value changes.

Closes #4791
Closes #1404
2014-09-23 16:03:53 -04:00
Jeff Cross
dc3de7fb7a feat($location): add ability to opt-out of <base/> tag requirement in html5Mode
This feature allows disabling Angular's requirement of using a <base/> tag
when using location in html5Mode, for applications that do not require
using $location in html5Mode in IE9. To accomplish this, the $locationProvider.html5Mode 
method has been changed to accept a definition object which can optionally set a 
requireBase property to false, removing the requirement of a <base> tag being present
when html5Mode is enabled.

BREAKING CHANGE: The $location.html5Mode API has changed to allow enabling html5Mode by
    passing an object (as well as still supporting passing a boolean). Symmetrically, the
    method now returns an object instead of a boolean value.

    To migrate, follow the code example below:

    Before:

    var mode = $locationProvider.html5Mode();

    After:

    var mode = $locationProvider.html5Mode().enabled;

Fixes #8934
2014-09-23 11:34:24 -07:00
Shahar Talmi
fd8997551f feat(formController): add $setUntouched to propagate untouched state
Closes #9050
2014-09-23 13:48:39 -04:00
Shahar Talmi
4b83f6ca2c fix(ngModel): support milliseconds in time and datetime
Closes #8874
2014-09-22 14:50:08 -07:00
Rouven Weßling
a591e8b8d3 perf(map): use Array.prototype.map
Replace helper functions with the native ES5 method
2014-09-22 14:09:48 -07:00
Maarten Stolte
17ecf84b90 docs(ngAria): fix wording 2014-09-22 11:35:10 -07:00
Ariel Mashraki
df8d9507aa docs(route): remove irrelevant note
Closes #9196
Closes #9200
2014-09-22 13:27:43 -04:00
Jeff Cross
3686f45398 chore($http): disable flaky JSONP test
See #9185
2014-09-19 17:19:57 -07:00
Brian Ford
ad28baaa6c refactor(ngAria): bind to ngModel rather than form types 2014-09-19 15:31:48 -07:00
Peter Bacon Darwin
8f9c4daca5 docs(limitTo): restore the missing * to make comment a jsdoc block 2014-09-19 22:53:48 +01:00
Peter Bacon Darwin
f0c94ea292 docs(limitTo): exclude the e2e test that fails on safari
Safari and doesn't like the minus key to be sent to it via Protractor.
Commenting out rather than using xit so that it passes the build!
2014-09-19 22:45:14 +01:00
Peter Bacon Darwin
729129b461 docs(limitTo): exclude the e2e test that fails on safari
Safari and doesn't like the minus key to be sent to it via Protractor.
Commenting out rather than using xit so that it passes the build!
2014-09-19 22:42:48 +01:00
Peter Bacon Darwin
bf2c55ea29 docs($aria): add basic missing docs for the $aria service
The individual service methods should be documented too.

cc: @arbus
2014-09-19 22:40:05 +01:00
Peter Bacon Darwin
deafb5e545 docs(limitTo): exclude the e2e test that fails on safari
Safari and doesn't like the minus key to be sent to it via Protractor.
2014-09-19 22:35:51 +01:00
Sekib Omazic
02169d4957 docs(angular.extend) actually only copies own enumerable properties
Closes #9007
2014-09-19 21:55:31 +01:00
jimmywarting
bd41bd594c docs(limitTo): fix input type in examples
Closes #8989
2014-09-19 21:24:04 +01:00
Georgios Kalpakas
373d7c95d9 docs(ngResource): fix error in one of the code examples
Closes #8948
Closes #9069
2014-09-19 19:36:43 +01:00
Subra
d1434c999a feat(ngAria): add an ngAria module to make a11y easier
Conditionally adds various aria attributes to the built in directives.
This module currently hooks into ng-show/hide, input, textarea and
button as a basic level of support for a11y.

Closes #5486 and #1600
2014-09-18 16:17:14 -07:00
Sebastian Müller
4f9dc44f88 refactor(ngMessages): remove unused $scope
Closes #9150
2014-09-18 16:04:47 -04:00
Georgios Kalpakas
f3884df0a9 docs(ngController): Fix priority value mentioned in the docs
The `@priority 500` part was missing from the ngDoc comment, thus the docs mentioned a priority of 0
(instead of the correct 500).

Closes #9070
2014-09-18 11:43:17 -04:00
Brian Ford
4627410245 fix(select): update option labels when model changes
Closes #9025
2014-09-16 12:36:05 -07:00
Igor Minar
76741a9393 refactor($parse): merge ternary and ternaryFn methods
splitting the code into two chunks doesn't buy us anything and only makes the code harder to follow
2014-09-16 14:12:59 +02:00
Igor Minar
8900390add refactor($parse): name anonymous fns for easier debugging and profiling 2014-09-16 14:12:59 +02:00
Jason Bedard
fca6be7127 perf($parse): execute watched expressions only when the inputs change
With this change, expressions like "firstName + ' ' + lastName | uppercase"
will be analyzed and only the inputs for the expression will be watched
(in this case "firstName" and "lastName"). Only when at least one of the inputs
change, the expression will be evaluated.

This change speeds up simple expressions like `firstName | noop` by ~15%
and more complex expressions like `startDate | date` by ~2500%.

BREAKING CHANGE: all filters are assumed to be stateless functions

Previously it was a good practice to make all filters stateless, but now
it's a requirement in order for the model change-observation to pick up
all changes.

If an existing filter is statefull, it can be flagged as such but keep in
mind that this will result in a significant performance-penalty (or rather
lost opportunity to benefit from a major perf improvement) that will
affect the $digest duration.

To flag a filter as stateful do the following:

myApp.filter('myFilter', function() {
  function myFilter(input) { ... };
  myFilter.$stateful = true;
  return myFilter;
});

Closes #9006
Closes #9082
2014-09-16 14:12:58 +02:00
Stephen Bunch
fd2d6c02f9 feat(ngInclude): add template url parameter to events
The 'src` (i.e. the url of the template to load) is now provided to the
`$includeContentRequested`, `$includeContentLoaded` and `$includeContentError`
events.

Closes #8453
Closes #8454
2014-09-16 12:25:33 +01:00
Georgii
cfdd16157e docs(ngModelOptions): mention that it's inherited
Closes #9096
Closes #7212
2014-09-15 20:27:31 +01:00
Peter Bacon Darwin
06280a14b4 docs(ngView): remove obsolete comment from code sample
Closes #9086
2014-09-15 17:09:37 +01:00
Melissa Ip
ea94e63e35 docs(ngShowHide): use backticks to denote CSS classes and directive names
add backticks around directive names to improve documentation consistency, as it's used in some
parts of the docs already.

Closes #9081
2014-09-14 20:27:39 -04:00
Caitlin Potter
e7ac08a061 fix($compile): update '@'-bindings in controller when bindToController is true
'@'-bindings were previously updating the scope when they ought to have been
updating the controller (requested via `bindToController: true` + controllerAs).

It's a one-line fix + test case.

Closes #9052
Closes #9077
2014-09-14 12:12:15 -04:00
Michael Benford
30354c58fe fix(jqLite): fix event.stopImmediatePropagation() so it works as expected
jqLite doesn't override the default implementation of event.stopImmediatePropagation()
and so it doesn't work as expected, i.e, it doesn't prevent the rest of the event
handlers from being executed.

Closes #4833
2014-09-13 15:11:49 -05:00
Caitlin Potter
d13b4bd1f5 fix($parse): ensure CSP assignable expressions have assign()
Fixes regression where the `assign()` method was not added to chains of identifiers in CSP mode,
introduced originally in b3b476d.

Also fixes the $parse test suite to ensure that CSP code paths are taken when they're expected to be
taken.

Closes #9048
2014-09-12 14:47:58 -04:00
Igor Minar
c1f2c3ea83 refactor($parse): remove commented out code 2014-09-12 16:08:24 +02:00