Commit graph

311 commits

Author SHA1 Message Date
Greg Thornton
5a294c8646 feat(Angular.js): skip JSON.stringify for undefined
Return early in `angular.toJson` if the object to be stringified is `undefined`.
IE8 stringifies `undefined` to `'undefined'` whereas other browsers return
`undefined`. This normalizes behavior and passes currently broken unit tests
in IE8.
2013-07-12 20:32:40 +02:00
Eric Subach
a83ed0e6c3 refactor(Angular.js): remove code duplication
Closes #2890
2013-07-11 22:01:29 +02:00
Marco Vito Moscaritolo
f89ba38dcd docs(angular.identity): fix missing 'angular' in identity function 2013-07-09 14:31:21 +01:00
Daniel Luz
7829c50f9e fix(angular.equals): do not match keys defined in the prototype chain
Merely testing for object[key] will give incorrect results on keys
defined in Object.prototype.
Note: IE8 is generally broken in this regard since `for...in` never returns
certain property keys even if they are defined directly on the object.

See #2141 - partially merges this PR
2013-07-08 11:05:08 +01:00
Sebastian Müller
22b9b47576 refactor(core): use native String.prototype.trim if available 2013-07-03 01:42:41 -07:00
joshkurz
807394095b fix(Angular.js): handle duplicate params in parseKeyValue/toKeyValue
parseKeyValue and toKeyValue can now handle duplicate values in the query.
```
?x=1&x=2 <-> {x:[1,2]}
```

The algorithm looks like:
    1)parseKeyValue looks for presence of obj[key]
    2)detects and replaces obj[key] with [obj[key],val]
    3)then pushes more duplicates if necessary
    4)toKeyValue decodes array correctly
    5)(not changed)$location.search({param: 'key'}) still replaces if necessary
    6)(not changed)$location.search({param: ['key1', 'key2']}) sets the url with duplicates

BREAKING CHANGE: Before this change:
- `parseKeyValue` only took the last key overwriting all the previous keys;
- `toKeyValue` joined the keys together in a comma delimited string.
This was deemed buggy behavior. If your server relied on this behavior
then either the server should be fixed or a simple serialization of
the array should be done on the client before passing it to $location.
2013-07-01 19:32:12 +01:00
Spencer Applegate
1532ec1dfe docs(Angular.js): explain that toJson strips $... properties
In Angular.toJson, any properties with a leading '$' character will be
stripped from the resulting string since angular uses this notation
internally for services.  There have been complaints of not knowing
about this functionality until it breaks within their code.
2013-07-01 11:35:16 +01:00
Chirayu Krishnappa
cefdaf131d fix($parse): move global getter out of parse.js 2013-06-24 20:46:32 -07:00
Pete Bacon Darwin
097947fd3b refactor(angular.bootstrap): rename internal function 2013-06-20 15:22:35 +01:00
Pete Bacon Darwin
8264d08085 fix(Angular.js): don't crash on invalid query parameters 2013-06-20 14:13:16 +01:00
Michał Gołębiowski
f1b94b4b59 feat(jqLite): switch bind/unbind to more recent jQuery on/off
jQuery switched to a completely new event binding implementation as of
1.7.0, centering around on/off methods instead of previous bind/unbind.
This patch makes jqLite match this implementation while still supporting
previous bind/unbind methods.
2013-06-19 20:53:24 +01:00
Ken Sheedlo
003861d2fd chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
Matias Niemelä
9faabd1ba0 chore(AngularPublic): remove angular.noConflict feature 2013-06-06 22:06:50 -07:00
Robbie Ferrero
dc238ce123 docs(Angular.js): clarify ngApp usage 2013-06-04 22:01:11 +01:00
Igor Minar
b8ea7f6aba feat(ngError): add error message compression and better error messages
- add toThrowNg matcher
2013-05-24 17:03:21 -07:00
Michał Gołębiowski
da5f537ccd fix(jqLite): correctly monkey-patch core jQuery methods
When real jQuery is present, Angular monkey patch it to fire `$destroy` event.

This commit fixes two issues in the jQuery patch:
- passing a selector to the $.fn.remove method (only fire `$destroy` on the matched elements)
- using `$.fn.html` without parameters as a getter (do not fire `$destroy`)
2013-05-23 12:05:55 -07:00
Joakim Blomskøld
59eb50204a docs(Angular.js): add missing @returns to extend() 2013-05-21 21:33:32 +01:00
Alex Pods
04d4c738b5 docs(Angular.js) move forEach docs to correct place 2013-05-09 22:04:13 +01:00
R. Merkert
6d0b325f7f fix(angular): do not copy $$hashKey in copy/extend functions.
Copying the $$hashKey as part of copy/extend operations makes little
sense since hashkey is used primarily as an object id, especially in
the context of the ngRepeat directive. This change maintains the
existing $$hashKey of an object that is being copied into (likewise for
extend).
It is not uncommon to take an item in a collection, copy it,
and then append it to the collection. By copying the $$hashKey, this
leads to duplicate object errors with the current ngRepeat.

Closes #1875
2013-05-08 12:45:32 +01:00
Misko Hevery
021bdf3922 fix($animator): remove dependency on window.setTimeout. 2013-04-22 23:13:26 -07:00
Laurent
cc1e4225b7 docs(Angular.js): fix typo 2013-04-15 11:42:34 +01:00
Matt Haggard
a92bb2e025 docs: fix typos 2013-04-11 15:03:59 -07:00
Brent Morrow
d521ad3ff6 docs(ngApp): fixed typo
Use this directive to auto-bootstrap **an** application.
2013-04-11 14:58:39 -07:00
Misko Hevery
0b6f1ce5f8 feat(ngAnimate): add support for animation 2013-04-02 14:05:06 -07:00
Pascal Borreli
9480136d9f docs(*): fixed typos 2013-03-29 23:14:55 +01:00
Javier Mendiara Cañardo
ef76afdf80 chore(Angular): remove superfluous fromCharCode function
Remove fromCharCode function as it was used only in two inner
functions in the code, and its functionality is achieved in several
other places by using String.fromCharCode

Breaks fromCharCode closure function, String.fromCharCode should be
used instead
2013-03-19 11:00:42 -07:00
Julie
603fe0d196 feat(angular.bootstrap): support deferred bootstrap
This features enables tools like Batarang and test runners to
hook into angular's bootstrap process and sneak in more modules
into the DI registry which can replace or augment DI services for
the purpose of instrumentation or mocking out heavy dependencies.

If window.name contains prefix NG_DEFER_BOOTSTRAP! when
angular.bootstrap is called, the bootstrap process will be paused
until angular.resumeBootstrap is called.

angular.resumeBootstrap takes an optional array of modules that
should be added to the original list of modules that the app was
about to be bootstrapped with.
2013-03-06 16:19:35 -08:00
Andrew McLeod
86d191ed4a fix($http): don't encode URL query substring "null" to "+"
Fixes issue in encodeUriQuery used by $http and $resource that
treats null as a string and replaces the characters "null" with "+".
2013-02-26 17:25:15 -08:00
James Morrin
12ba6cec4f feat(noConflict): restore previous angular namespace reference 2013-02-14 14:43:55 -08:00
Shyam Seshadri
755beb2b66 fix(compiler): Allow startingTag method to handle text / comment nodes 2013-02-14 14:43:55 -08:00
Igor Minar
9e57ce0c7a revert: refactor(angular.copy): use slice(0) to clone arrays
This reverts commit 28273b7f1ef52e46d5bc23c41bc7a1492cf23014o.

slice(0) doesn't perform deep copy of the array so its unsuitable
for our purposes.
2013-02-11 21:58:00 -08:00
Igor Minar
6b19e7d527 refactor(angular.copy): use array.length=0 to empty arrays 2013-02-11 14:07:49 -08:00
Igor Minar
28273b7f1e refactor(angular.copy): use slice(0) to clone arrays
slice(0) is way faster on most browsers
2013-02-11 14:07:03 -08:00
Igor Minar
ec54712ff3 fix(angular.forEach): correctly iterate over objects with length prop
Should handle JQLite, jQuery, NodeList and other objects like arrays
but not other generic objects or instances of user defined types
with length property.

Closes #1840
2013-02-11 12:29:55 -08:00
radu
7cc4063303 docs(ngApp): fix typo 2013-02-05 21:29:11 +01:00
radu
17fc6a70fe docs(nextUid): fix typo
Update src/Angular.js

removed redundant 'the' from nextUid()'s ngdoc
2013-01-29 15:49:10 -08:00
metaweta
e4cfb9d938 refactor(Angular.js): prevent Error variable name leak in tests
Remove var Error = window.Error

window.Error is a read-only property in Apps Script.

Igor says, "we should just delete that line instead. I think it was
misko's attempt to get better closure minification, but it turns out
that it's actually hurting us after gzip (I verified it)."
2013-01-29 13:24:33 -08:00
Igor Minar
3c2e1c5e4d fix(angular.equals): relax the comparison for undefined properties
in 5ae63fd3 the comparison was made consistent but strict, so that

angular.equals({}, {foo: undefined}) // always returns false

this turns out to cause issues for data that is being roundtripped via network
and serialized via JSON because JSON.stringify serializes {foo: undefined} as {}.

Since angular.equals() behaved like this before the 5ae63fd3 in 50% of the cases,
changing the behavior in this way should not introduce any significant issues.

Closes #1648
2013-01-22 07:35:21 -08:00
Igor Minar
5ae63fd385 fix(angular.equals): consistently compare undefined object props
previously:

a = {};
b = {x:undefined};
angular.equals(a, b) == angular.equals(b, a) // returns false.

both should return false because these objects are not equal.

unlike in implemented in #1695 the comparison should be stricter
and return false not true. if we need to relax this in the future
we can always do so.

Closes #1648
2013-01-17 17:48:51 -08:00
Kris Jenkins
b21f4a376d docs(): Fix a couple of typos in the documentation 2012-11-21 23:06:59 +01:00
Josh Adams
a758799c7f docs(encodeUriSegment): fix typo 2012-11-11 11:22:43 +01:00
Igor Minar
f16150d5f1 docs(*): simplify doc urls
we now have two types of namespaces:

- true namespace: angular.* - used for all global apis
- virtual namespace: ng.*, ngMock.*, ... - used for all DI modules

the virual namespaces have services under the second namespace level (e.g. ng.)
and filters and directives prefixed with filter: and directive: respectively
(e.g. ng.filter:orderBy, ng.directive:ngRepeat)

this simplifies urls and makes them a lot shorter while still avoiding name collisions
2012-06-12 00:10:18 -07:00
Igor Minar
5c95b8cccc fix(startingTag): make tag name always lowercase
some browsers (IE) always provide the nodeName as upper-case
2012-06-08 15:27:04 -07:00
Misko Hevery
6933fb7924 docs(bootstrap): rewritten bootstrap guide 2012-06-02 16:02:05 -07:00
Misko Hevery
85632cb44c feat($rootElement): added application root element
Publish the application root element as $rootElement
so that it can be injected to other services.
2012-06-02 14:50:58 -07:00
Misko Hevery
eafe15f54c fix(document): accidental clobbering of document.getAttribute
Closes #877
2012-04-20 11:29:33 -07:00
Igor Minar
52ee1ab5eb chore(*): remove dead code and fix code style issues 2012-04-10 16:52:12 -07:00
Igor Minar
5c0ec9d06d docs(angular.bootstrap): fix typos and errors 2012-04-10 13:21:29 -07:00
Igor Minar
82d90a4096 fix(docs): change all directive references to use the normalized names 2012-04-09 09:52:27 -07:00
Vojta Jina
6da355c3e1 refactor($compile): move methods of attr object into prototype
We have many instances of this object and we clone them as well (e.g. ng-repeat).
This should save some memory and performance as well.

Double prefixed private properties of attr object:
attr.$element -> attr.$$element
attr.$observers -> attr.$$observers

Update shallowCopy to not copy $$ properties and allow passing optional destination object.
2012-03-29 07:30:32 -07:00