Commit Graph

5047 Commits

Author SHA1 Message Date
Igor Minar
2df721965b chore(saucelabs): add verbose tunnel logging flag
This will log all requests going through the tunnel which is helpful when debugging flakes
2014-06-30 08:57:08 -07:00
Igor Minar
36625de0d3 perf(forEach): use native for loop instead of forEach for Arrays 2014-06-30 08:48:25 -07:00
Kristian Hellang
31ae3e7164 fix($http): should not read statusText on IE<10 when request is aborted
Commit 1d2414c introduced a regression by retrieving the statusText
of an aborted xhr request. This breaks IE9, which throws a c00c023f
error when accessing properties of an aborted xhr request. The fix
is similar to the one in commit 6f1050d.
2014-06-30 08:09:01 -07:00
Julien Sanchez
b59b04f98a fix(Angular.copy): preserve prototype chain when copying objects
So far, angular.copy was copying all properties including those from
prototype chain and was losing the whole prototype chain (except for Date,
Regexp, and Array).

Deep copy should exclude properties from the prototype chain because it
is useless to do so. When modified, properties from prototype chain are
overwritten on the object itself and will be deeply copied then.

Moreover, preserving prototype chain allows instanceof operator to be
consistent between the source object and the copy.
Before this change,

    var Foo = function() {};
    var foo = new Foo();
    var fooCopy = angular.copy(foo);
    foo instanceof Foo; // => true
    fooCopy instanceof Foo; // => false

Now,

    foo instanceof Foo; // => true
    fooCopy instanceof Foo; // => true

The new behaviour is useful when using $http transformResponse. When
receiving JSON data, we could transform it and instantiate real object
"types" from it. The transformed response is always copied by Angular.
The old behaviour was losing the whole prototype chain and broke all
"types" from third-party libraries depending on instanceof.

Closes #5063
Closes #3767
Closes #4996

BREAKING CHANGE:

This changes `angular.copy` so that it applies the prototype of the original
object to the copied object.  Previously, `angular.copy` would copy properties
of the original object's prototype chain directly onto the copied object.

This means that if you iterate over only the copied object's `hasOwnProperty`
properties, it will no longer contain the properties from the prototype.
This is actually much more reasonable behaviour and it is unlikely that
applications are actually relying on this.

If this behaviour is relied upon, in an app, then one should simply iterate
over all the properties on the object (and its inherited properties) and
not filter them with `hasOwnProperty`.

**Be aware that this change also uses a feature that is not compatible with
IE8.**  If you need this to work on IE8 then you would need to provide a polyfill
for `Object.create` and `Object.getPrototypeOf`.
2014-06-30 10:41:43 +01:00
vaibhav kohli
ffdde26981 style(Angular.js): remove extra whitespace 2014-06-29 09:42:14 -07:00
rodyhaddad
075ba901f6 docs($rootScope): fix incorrect param name in $watchGroup description
Closes #7834
2014-06-28 21:59:16 -07:00
Archer
384c24808f docs(guide/$location): fix a typo
Change "window.location.path" to "window.location.pathname".

Closes #8012
2014-06-28 20:04:05 -07:00
Elnur Abdurrakhimov
a87ffe37bf docs(Getting Started): fix typo
Closes #8015
2014-06-28 19:41:32 -07:00
rodyhaddad
bc595509dd test($interval): add tests making sure $interval uses the methods from $window 2014-06-28 17:32:32 -07:00
Praveen
a4904c0f83 fix($interval): when canceling, use clearInterval from $window instead of global scope.
In $interval.cancel, use clearInterval from the $window service instead of from global scope.
The variable clearInterval declared above isn't visible here.
2014-06-28 17:32:32 -07:00
ncuillery
d3c191ea63 docs(input): fix a typo 2014-06-28 15:14:45 -07:00
Shahar Talmi
7e71acd178 feat(jqLite): support isDefaultPrevented for triggerHandler dummies
triggerHandler sends dummy events to an element, but although the event includes the preventDefault method, there is no way to see if it was called for the event. This is sometimes important when testing directives that use preventDefault

Closes #8008
2014-06-27 17:10:10 -07:00
Efthymis Sarbanis
0235420196 chore: use triple equals comparison with typeof operator.
It is common practice for typeof operator to be used with '==='.

Closes #8009
2014-06-27 16:53:13 -07:00
Caitlin Potter
19b6b3433a fix($timeout/$interval): if invokeApply is false, do not use evalAsync
$evalAsync triggers a digest, and is unsuitable when it is expected that a digest should not occur.

BREAKING CHANGE

Previously, even if invokeApply was set to false, a $rootScope digest would occur during promise
resolution. This is no longer the case, as promises returned from $timeout and $interval will no
longer trigger $evalAsync (which in turn causes a $digest) if `invokeApply` is false.

Workarounds include manually triggering $scope.$apply(), or returning $q.defer().promise from a
promise callback, and resolving or rejecting it when appropriate.

    var interval = $interval(function() {
      if (someRequirementFulfilled) {
        $interval.cancel(interval);
        $scope.$apply();
      }
    }, 100, 0, false);

or:

    var interval = $interval(function (idx) {
      // make the magic happen
    }, 1000, 10, false);
    interval.then(function(idx) {
      var deferred = $q.defer();
      // do the asynchronous magic --- $evalAsync will cause a digest and cause
      // bindings to update.
      return deferred.promise;
    });

Closes #7999
Closes #7103
2014-06-27 12:11:11 -04:00
Ciro Nunes
b28b5caab1 fix($http): add the PATCH shortcut back
The shortcut was dropped because it had a lot of unkowns about PATCH.
Since we already know that using PATCH is good
(http://www.mnot.net/blog/2012/09/05/patch), and only IE8 has issues with that,
let's add the shortcut back.

Closes #5894
2014-06-27 15:23:42 +02:00
Igor Minar
26c20b75c6 revert: chore($resource): refactor confusing case statement
This reverts commit d50829bcf7.

This commit introduces a regression that results in urls with
parameters being incorrectly generated. We need to investigate
further why this is happening, for now I'm just reverting.
2014-06-26 13:48:10 -07:00
Michał Gołębiowski
bdfc9c02d0 fix(core): drop the toBoolean function
So far Angular have used the toBoolean function to decide if the parsed value
is truthy. The function made more values falsy than regular JavaScript would,
e.g. strings 'f' and 'no' were both treated as falsy. This creates suble bugs
when backend sends a non-empty string with one of these values and something
suddenly hides in the application

Thanks to lgalfaso for test ideas.

BREAKING CHANGE: values 'f', '0', 'false', 'no', 'n', '[]' are no longer
treated as falsy. Only JavaScript falsy values are now treated as falsy by the
expression parser; there are six of them: false, null, undefined, NaN, 0 and "".

Closes #3969
Closes #4277
Closes #7960
2014-06-26 20:52:04 +01:00
Domenic Denicola
e970df8554 docs($q): remove unnecessary $scope.apply wrapping
As of Angular 1.2, this kind of thing is no longer necessary (thank goodness!)
2014-06-26 12:36:39 -07:00
rodyhaddad
a1c19c457b chore(ngMock): replace misplaced comma with semicolon 2014-06-26 12:32:01 -07:00
Laurent Curau
c4b654b03c docs(guide/unit-testing): correct spelling 2014-06-26 12:20:57 -07:00
Eddie Hedges
1054dce4a9 docs(guide/introduction): use durandal as an example of a framework
To me knockout is a library that does data binding well.
Durandal is a framework that uses knockout as it's data binding component.
2014-06-26 12:19:01 -07:00
m-tretyak
1296e7a72e docs(srcset): fix mistake in example 2014-06-26 12:07:33 -07:00
thorn0
85f8b65442 docs($location): hashPrefix, html5Mode are methods
Closes #7915
2014-06-25 14:49:00 -07:00
Lucas Galfaso
d9763f1bd3 fix($parse): handle constants as one-time binding expressions
Handle constant expressions as one-time binding expressions.
Avoids the infinite digest from
https://github.com/angular/angular.js/pull/7960/files#r14136938

Closes #7970
2014-06-25 22:38:18 +01:00
Peter Bacon Darwin
91754a76e0 fix(jqLite): never add to the cache for non-element/document nodes
Calling `jqLite.data()` on a disallowed node type caused an empty object to be added to the
cache. This could lead to memory leaks since we no longer clean up such node types when they are
removed from the DOM.

Closes #7966
2014-06-25 22:36:44 +01:00
Peter Bacon Darwin
768a1912cf test(compile): check transclusion/scopes work with multi-element directives 2014-06-25 22:34:04 +01:00
Peter Bacon Darwin
462dbb2016 fix(jqLite): don't attach event handlers to comments or text nodes
We were attaching handlers to comment nodes when setting up bound transclusion
functions. But we don't clean up comments and text nodes when deallocating so
there was a memory leak.

Closes #7913
Closes #7942
2014-06-25 22:34:04 +01:00
Peter Bacon Darwin
7f63e811ac test($compile): check no memory leak with coexisting element transcludes
If an element contains two "element" transcludes then the initial clone
consists of only comment nodes.  The concern was that this meant that
the transclude scopes would not be cleaned up.

But it turns out that in the case that there are only comments then the
scope is never attached to anything so we don't need to worry about cleaning
it up.

Later if a concrete element is created as part of the transclude then these
elements will have destroy handlers.
2014-06-25 22:32:46 +01:00
Peter Bacon Darwin
cb43711f8f test($compile): check for memory leaks in nested transclusion 2014-06-25 22:32:46 +01:00
Caitlin Potter
1f6a5a1a92 fix(input): improve html5 validation support
This CL improves mocking support for HTML5 validation, and ensures that it works correctly along
with debounced commission of view values.

Closes #7936
Closes #7937
2014-06-24 08:35:00 -04:00
Christophe Krebser
deb008d638 test(input): test that input[email"] and ngRequired don't interfere w/ eachother
ngRequired added to an email field wasn't working properly. ng-invalid-required
stayed true unless a valid email was entered.

correct behaviour is that it turns to ng-valid-required at first entered key.

Closes #7849
2014-06-24 00:58:05 -07:00
Matias Niemelä
6737924210 feat(NgModel): port the email input type to use the validators pipeline 2014-06-24 00:46:30 -07:00
Matias Niemelä
3ee6573063 feat(NgModel): port the URL input type to use the validators pipeline 2014-06-24 00:46:30 -07:00
Igor Minar
189cd064fe fix(numberFilter): correctly round fractions despite floating-point arithmetics issues in JS
Closes #7870
Closes #7878
2014-06-23 23:49:56 -07:00
Igor Minar
ceaea861eb fix(jqLite): convert NodeList to an Array to make PhantomJS 1.x happy
Closes #7851
2014-06-23 21:58:38 -07:00
Igor Minar
b1a6baac2d fix($injector): check if a fn is an array explicitly
This change makes the code easier to read and also fixes a compatibility issue
with opal.js which pollutes the global state by setting $inject property on
Array prototype

Closes #7904
Closes #2653
2014-06-23 17:19:41 -07:00
Michał Gołębiowski
43ff573bc8 chore(travis): declare Node.js version as '0.10', not 0.10 (which is 0.1) 2014-06-24 00:19:17 +02:00
Michał Gołębiowski
e8e0750277 fix(testabilityPatch): fix invocations of angular.mock.dump 2014-06-23 23:38:15 +02:00
Zacky Ma
ea820b53e1 docs(guide/compiler): change {{user}} to {{user.name}} in example
If user has an `actions` property, it should be an object,
which means if you {{user}}, it'll print out the object.
2014-06-23 13:35:03 -07:00
ephigabay
05ec6cc5c9 docs(ngModelController): update setValidity
Needs to be `$error[validationErrorKey]!=isValid` and not
`$error[validationErrorKey]=isValid`.

See https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L1627

Closes #7934
2014-06-23 13:23:52 -07:00
Chaker Nakhli
0885446b82 docs(ngSrc): srcset used instead of src for img attribute
In `ngSrc` documentation `srcset` is used instead of `src` as `img` element attribute in the example.

Closes #7951
2014-06-23 13:13:53 -07:00
Shahar Talmi
b775e2bca1 fix(input): escape forward slash in email regexp
This messed up with syntax coloring and variable hovering in chrome developer tools and made debugging really difficult.

Closes #7938
2014-06-22 21:28:22 -04:00
Peter Bacon Darwin
e57ad6a109 docs($provide): it is a service not an object
Closes #7917
2014-06-20 17:00:59 +01:00
Yuri Sulyma
dafb8a3cd1 fix(Angular): nodeName should always be lowercase
XHTML uses lowercase node names, while HTML often uses uppercase.  The
generally accepted convention is to always lowercase them.

Fixes #3987
2014-06-20 14:58:02 +01:00
Laurent Curau
ebff4c1fd2 docs(ngMessages): correct a typo
Closes #7918
2014-06-20 14:57:24 +01:00
Alex Muntada
28e6500a59 docs(tutorial/step-4): fix e2e test
After a protractor update the test syntax had to be changed.

Closes #7919
2014-06-20 14:35:57 +01:00
Neil Giarratana
307e72efab docs(ngPluralize): spell Mary's name correctly
Update ngPluralize.js

Just a silly change to the name of one of the examples that appears to be a typo. Changing Marry to
Mary as the first would be a verb and the latter would be an extremely common name.

Closes #7884
2014-06-17 17:42:34 -04:00
Shahar Talmi
2f0a448873 fix(injector): allow multiple loading of function modules
Change HashMap to give $$hashKey also for functions so it will be possible to load multiple module
function instances. In order to prevent problem in angular's test suite,  added an option to HashMap
to maintain its own id counter and added cleanup of $$hashKey from all module functions after each
test.

Before this CL, functions were added to the HashMap via toString(), which could potentially return
the same value for different actual instances of a function. This corrects this behaviour by
ensuring that functions are mapped with hashKeys, and ensuring that hashKeys are removed from
functions and objects at the end of tests.

In addition to these changes, the injector uses its own set of UIDs in order to prevent confusingly
breaking tests which expect scopes or ng-repeated items to have specific hash keys.

Closes #7255
2014-06-16 20:43:16 -04:00
Jason Bedard
8b0258d878 fix($compile): bind ng-attr-* even if unbound attribute follows ng-attr-*
Previously, <element ng-attr-foo="{{binding}}" foo="bar"></element>'s "foo" attribute would always
equal "bar", because the bound version was overwritten. This CL corrects this behaviour and ensures
that the ordering of attributes does not have an effect on whether or not ng-attr-bound attributes
do their work.

Closes #7739
2014-06-16 19:15:36 -04:00
Ahmad Moussawi
928c7ecf39 docs($sce): update the parseAs method name 2014-06-16 13:44:07 -07:00