Commit Graph

448 Commits

Author SHA1 Message Date
Jeremiah Hoyet
6502ab0977 doc(angular.forEach): note difference from ES262's Array.prototype.forEach
Since Angular's forEach is not a strict polyfill, and takes different paths depending on the type
of collection it is dealing with, it does not throw a TypeError when converting the obj with
ToObject(), as this operation does not need to be performed.

This difference is documented nicely here.

Closes #9142
2014-10-14 10:55:31 -04:00
Julie Ralph
02aa4f4b85 fix(testability): escape regex chars in findBindings if using exactMatch
Move the function to escape regexps to Angular.js, fix the link, and use it in
the $$testability service.

Closes #9595
Closes #9600
2014-10-14 10:42:13 +01:00
Warlock
e83fab9568 docs(angular.extend): merge redundant sentences 2014-10-10 10:37:15 -07:00
Warlock
4568bc037d docs: update angular.extend() documentation
How to preserve original objects similar to jQuery.extend().

Closes #9087
2014-10-09 12:11:16 -07:00
Caitlin Potter
cae01f4941 refactor($compile): use labaled variables to represent nodeType values
This also does some cleanup in $animate
2014-10-08 14:56:49 -04:00
Igor Minar
a84480affb refactor: use document.documentMode to determine msie version
Closes #9398
2014-10-07 16:09:50 -07:00
Caitlin Potter
feba0174db fix($compile): remove comment nodes from templates before asserting single root node
The compiler will no longer throw if a directive template contains comment nodes in addition to a
single root node. If a template contains less than 2 nodes, the nodes are unaltered.

BREAKING CHANGE:

If a template contains directives within comment nodes, and there is more than a single node in the
template, those comment nodes are removed. The impact of this breaking change is expected to be
quite low.

Closes #9212
Closes #9215
2014-10-03 21:41:13 -04: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
Sekib Omazic
02169d4957 docs(angular.extend) actually only copies own enumerable properties
Closes #9007
2014-09-19 21:55:31 +01:00
Peter Bacon Darwin
14183833f9 docs(angular.getTestability): unpublish the function as it is not public 2014-09-10 18:53:15 +01:00
Peter Bacon Darwin
d307e77ff3 docs(angular.testability): add jsdoc marker to ensure it is included in docs 2014-09-10 15:02:38 +01:00
Jason Bedard
9bedeb3353 perf(extend): remove use of forEach to remove calls/closures/passing arguments
Closes #8898
2014-09-08 17:15:02 +02:00
Jason Bedard
df9e60c8e7 feat(angular.forEach): add the array/object as the 3rd param like the native array forEach
Closes #7902
2014-09-08 17:06:16 +02:00
Jason Bedard
f6aa1c5561 perf(jQuery): only trigger $destroy if a handler exists
Speeds up largetable destruction by 30% (500ms) when jQuery 2.1.1 is present.

Closes #8859
2014-09-07 23:56:11 +02:00
Rouven Weßling
300bffc4fe refactor(indexOf) use Array.prototype.indexOf exclusively
Replace helper functions with the native ES5 method

Closes #8847
2014-09-03 13:37:03 +01:00
Julie
85880a6490 feat(testability): add $$testability service
The $$testability service is a collection of methods for use when debugging
or by automated testing tools. It is available globally through the function
`angular.getTestability`.
For reference, see the Angular.Dart version at
https://github.com/angular/angular.dart/pull/1191
2014-08-28 14:25:50 -07:00
Brian Ford
c6bde52006 docs(debugInfo): add docs for $compileProvider.debugInfoEnabled() 2014-08-27 20:45:59 -07:00
Vojta Jina
36a547b852 refactor: remove doReload arg used only for testing
We run unit tests in “strict” mode and thus can’t monkey-patch `window.location` nor `window.location.reload`. In order to avoid full page reload, we could pass location as argument, or another level of indirection, something like this:
```js
var ourGlobalFunkyLocation = window.location;
function reloadWithDebugInfo() {
  window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
  ourGlobalFunkyLocation.reload();
}

// in the test
ourGlobalFunkyLocation = {
  reload: function() {}
};
reloadWithDebugInfo();
ourGlobalFunkyLocation = window.location;
```

I don’t think any of these make sense, just so that we can test setting `window.name`. If the `reloadWithDebugInfo` function was more complicated, I would do it.

I don’t think it’s worthy to confuse production code with extra logic which purpose was only to make testing possible.
2014-08-27 20:45:59 -07:00
Peter Bacon Darwin
41c1b8858f feat: add angular.reloadWithDebugInfo() 2014-08-27 20:45:58 -07:00
Igor Minar
a4520a745d fix(Angular): remove duplicate nodeName_ references
I forgot to remove the variable declaration in previous nodeName_ commit.
2014-08-27 13:56:13 -07:00
Richard Harrington
fe697527b4 docs(shallowCopy): add missing word 'are' and period.
Closes #8794
2014-08-27 08:38:35 -04:00
Igor Minar
5a1a0c9622 perf(nodeName_): simplify the code and reduce the number of DOM calls 2014-08-26 15:00:35 -07:00
Igor Minar
4ebbd7e210 refactor(nodeName_): remove IE8 specific branch 2014-08-26 15:00:34 -07:00
Shahar Talmi
642af96c48 refactor(Angular): make NaN check in date equality cleaner
Closes #8718
2014-08-22 13:52:06 -07:00
Igor Minar
0c4997f7d8 style: name anonymous fn that causes initial digest for better debugging/profiling 2014-08-22 11:46:45 -07:00
Sekib Omazic
693e846add fix(Angular): make Date comparison in equals() NaN-aware
Make angular.equals() Date comparison NaN-aware to prevent infinite digest errors when a dealy watched
date has an invalid value.

Closes #8650
Closes #8715
2014-08-21 21:17:21 -04:00
Caitlin Potter
a603e202cc fix(copy): clear array destinations correctly for non-array sources
Closes #8610
Closes #8702
2014-08-20 21:49:54 -04:00
Jeff Cross
0872388a1b fix(minErr): encode btstrpd error input to strip angle brackets
The $sanitize service was returning an empty string to the error page
because the input was usually a single html tag (sometimes it could be
`document`). This fix replaces angle brackets with html entities.

Closes #8683
2014-08-20 17:26:50 -07:00
Caitlin Potter
36230194be fix(forEach): match behaviour of Array.prototype.forEach (ignore missing properties)
Array.prototype.forEach will not invoke the callback function if the properety is not present in the
object. Because of this, we have the illusion of not iterating over non-added properties in a sparse
array.

From ECMAScript:

9. Repeat while k < len
     a. Let Pk be ToString(k).
     b. Let kPresent be HasProperty(O, Pk).
     c. ReturnIfAbrupt(kPresent).
     d. If kPresent is true, then
            i. Let kValue be Get(O, Pk)
            ... (steps for invoking the function and aborting if it throws)

Closes #8510
Closes #8522
Closes #8525
2014-08-20 19:27:49 -04:00
Igor Minar
b0571517c5 refactor(isArray): use Array.isArray exclusively
IE9 supports Array.isArray so we don't need a polyfill any more.
2014-08-18 21:20:09 -07:00
Igor Minar
b24e381427 style(shallowCopy): use common for loop style 2014-08-16 22:32:35 -07:00
Igor Minar
d208ba2544 perf(isObject): use strict comparison
this is a micro-optimization based on http://jsperf.com/isobject4

no significant improvement in macro-benchmarks, but since it makes the code better it makes
sense making this change.
2014-08-16 22:06:14 -07:00
Igor Minar
d302ea0cfa perf($parse): use no-proto maps as caches and avoid hasOwnProperty checks 2014-08-16 21:59:38 -07:00
Igor Minar
13d113c522 perf(ngRepeat): use no-proto objects for blockMaps 2014-08-16 21:51:56 -07:00
Igor Minar
54fa16e45d perf: speed up shallowCopy and special case Attributes cloning
`for in` is much faster than `Object.keys()` but `for in` includes properties from the prototype.

http://jsperf.com/for-in-vs-object-keys2

All the uses of shallowCopy don't deal with objects with heavy prototypes, except for Attributes instances
in $compile.

For this reason it's better to special-case Attributes constructor and make it do it's own shallow copy.
This cleans up the Attribute/$compile code as well.
2014-08-16 21:29:51 -07:00
Igor Minar
fb00210cb6 refactor(shallowCopy): microoptimization 2014-08-16 21:01:13 -07:00
Igor Minar
e6a9f9e130 refactor: simplify trim fn now that IE9 has String#trim 2014-08-16 21:01:12 -07:00
Igor Minar
441ab5235c refactor: rename getBlockElements to more correct getBlockNodes 2014-08-16 21:01:11 -07:00
Michał Gołębiowski
b9389b26ba fix(jQuery): cooperate with other libraries monkey-patching jQuery.cleanData
Some libraries (like jQuery UI) patch jQuery.cleanData as well. This commit
makes Angular work correctly even if such external patching was done after
the Angular one.

Fixes #8471
2014-08-14 21:09:13 +02:00
Michał Gołębiowski
9e7cb3c375 feat(jQuery): upgrade to jQuery to 2.1.1
The data jQuery method was re-implemented in 2.0 in a secure way. This made
current hacky Angular solution to move data between elements via changing the
value of the internal node[jQuery.expando] stop working. Instead, just copy the
data from the first element to the other one.

Testing cache leaks on jQuery 2.x is not possible in the same way as it's done
in jqLite or in jQuery 1.x as there is no publicly exposed data storage. One
way to test it would be to intercept all places where a jQuery object is created
to save a reference to the underlaying node but there is no single place in the
jQuery code through which all element creation passes (there are various
shortcuts for performance reasons). Instead we rely on jqLite.cache testing
to find potential data leaks.

BREAKING CHANGE: Angular no longer supports jQuery versions below 2.1.1.
2014-07-31 22:20:31 +02:00
Jeff Cross
3625803349 fix($location): add semicolon to whitelist of delimiters to unencode
Some servers require characters within path segments to contain semicolons,
such as `/;jsessionid=foo` in order to work correctly. RFC-3986 includes
semicolons as acceptable sub-delimiters inside of path and query, but $location
currently encodes semicolons. This can cause an infinite digest to occur since $location
is comparing the internal semicolon-encoded url with the semicolon-unencoded url returned
from window.location.href, causing Angular to believe the url is changing with each digest
loop.

This fix adds ";" to the list of characters to unencode after encoding queries or path segments.

Closes #5019
2014-07-29 11:03:21 -07:00
Shahar Talmi
86340a59bf fix(angular.copy): clone regexp flags correctly
Closes #5781
Closes #8337
2014-07-25 16:37:53 +01:00
chirag
c03b9e5ec4 style(Angular.js): remove unused variables
Closes #8331
2014-07-25 15:08:03 +01:00
Shahar Talmi
d1df21e45e refactor(Angular): add isPromiseLike helper function
This can be used internally to remove the repeating pattern of `obj && obj.then`. For now, I don't see a good reason to expose this in angular's public interface.
2014-07-22 16:31:24 -07:00
Carlo s A. Guillen
3f4ee15139 fix($location): handle plus character in query strings
Closes #3042
2014-07-18 08:36:16 -07:00
Almar
d2f348b04c docs(misc core): fixed broken angular.copy example
The module was not being registered, and this broke the example for who knows how long!

Closes #8218
2014-07-16 11:30:16 -04:00
Lucas Galfaso
666a3835d2 refactor(bootstrap): Remove support for old bootstrap mechnanisms
Remove support for bootstrap detection using:

* The element id
* The element class.

E.g.

```
<div id="ng-app">...</div>
<div class="ng-app: module">...</div>
```

Removes reference to how to bootstrap using IE7

BREAKING CHANGE:

If using any of the mechanisms specified above, then migrate by
specifying the attribute `ng-app` to the root element. E.g.

```
<div ng-app="module">...</div>
```

Closes #8147
2014-07-15 17:20:26 -07:00
Igor Minar
0113f22574 fix(csp): fix autodetection of CSP + better docs
CSP spec got changed and it is no longer possible to autodetect if a policy is
active without triggering a CSP error:

18882953ce

Now we use `new Function('')` to detect if CSP is on. To prevent error from this
detection to show up in console developers have to use the ngCsp directive.

(This problem became more severe after our recent removal of `simpleGetterFn`
 which made us depend on function constructor for all expressions.)

Closes #8162
Closes #8191
2014-07-14 17:18:39 -07:00
Michał Gołębiowski
36831eccd1 refactor(jshint): reduce duplication & test all JS files 2014-07-08 15:49:25 +02:00
Brian Ford
282ed94cf9 docs(angular.copy): update example to use a module 2014-07-08 02:00:20 -07:00