Commit graph

45 commits

Author SHA1 Message Date
Misko Hevery
d9b58f23f6 move(compiler): appease the History God
-	renamed:    src/Compiler.js -> src/service/compiler.js
-	renamed:    test/CompilerSpec.js -> test/service/compilerSpec.js
2011-11-14 16:39:32 -08:00
Misko Hevery
48697a2b86 refactor(injector): turn scope into a service
- turn scope into a $rootScope service.
- injector is now a starting point for creating angular application.
- added inject() method which wraps jasmine its/beforeEach/afterEach,
  and which allows configuration and injection of services.
- refactor tests to use inject() where possible

BREAK:
- removed angular.scope() method
2011-11-14 16:39:31 -08:00
Igor Minar
f38010d3a2 fix(compiler): revert 8611ebe6 - calling \$digest after linking
Change introduced by me in 8611ebe6 results in considerable inefficiencies when the compiler
and linker is used from within a widget, in which case, we call $digest unnecessary since it
will be called by the $apply which called the directive/widget in the first place.

There are only two places when the extra $digest call can be useful - when manually bootstrapping
the app or in tests. However even in tests this behavior can result in unwanted results (especially
when ng:controller is involved). So it is better to leave it for the developer to call $digest
when it is really needed.
2011-10-20 15:51:14 -07:00
Igor Minar
8611ebe6a0 fix(compiler): linking function should call $digest
The linked scope should be $digest-ed but only if a $digest isn't
already running on it.
2011-10-12 23:04:48 -07:00
Misko Hevery
fd822bdaf9 chore(formating): clean code to be function() { 2011-10-11 11:01:46 -07:00
Igor Minar
7ae536d053 fix(specs): various fixes to get IE8+jquery unit tests green 2011-09-16 02:44:33 +02:00
Misko Hevery
42062dab34 refactor(scope): remove $flush/$observe ng:eval/ng:eval-order 2011-08-12 15:47:47 -07:00
Misko Hevery
8f0dcbab80 feat(scope): new and improved scope implementation
- Speed improvements (about 4x on flush phase)
- Memory improvements (uses no function closures)
- Break $eval into $apply, $dispatch, $flush
- Introduced $watch and $observe

Breaks angular.equals() use === instead of ==
Breaks angular.scope() does not take parent as first argument
Breaks scope.$watch() takes scope as first argument
Breaks scope.$set(), scope.$get are removed
Breaks scope.$config is removed
Breaks $route.onChange callback has not "this" bounded
2011-08-02 01:00:03 +02:00
Igor Minar
fe5240732d feat(strict mode): adding strict mode flag to all js files
the flag must be in all src and test files so that we get the benefit of
running in the strict mode even in jstd

the following script was used to modify all files:

for file in `find src test -name "*.js"`; do
  echo -e "'use strict';\n" > temp.txt
  cat $file >> temp.txt
  mv temp.txt $file
done
2011-07-18 12:12:55 -07:00
Vojta Jina
d0edc11704 Fix failing unit tests in IE7 (Binder, select widget)
The fix does not change any production code, we only need to ignore couple of attributes that IE7 should not display:
* value attribute for LI
* selected attribut for SELECT

Simplified condition in compiler test, this should have been part of f9f0905f4a
2011-06-17 22:48:22 +02:00
Vojta Jina
f9f0905f4a Fix compiler test for IE9
Older IEs serialize html uppercased, but IE9 does not...
Would be better to expect case insensitive, unfortuntaly jasmine does not allow
to user regexps for throw expectations.

Closes #392
2011-06-17 19:48:49 +02:00
Misko Hevery
04a62e83bc Throw error when compiling multiple roots
Closes #338
2011-06-08 15:21:33 -07:00
Igor Minar
945056b166 linking function should return bound scope
angular.compile()() returns {scope:scope, view:view},
this isn't useful at all and only makes tests more verbose.
Instead, this change makes the linking function return scope directly
and if anyone needs the linked dom there are two ways to do it
documented in angular.compile.

other changes:
- moved angular.compile docs to the compiler so that they are closer to
  the compiler
- fixed some typos and updated angular.compile docs with the new return
  value
2011-03-01 17:09:25 -08:00
Misko Hevery
c7998f5f99 add class on any namespace elments 2011-02-22 15:23:08 -08:00
Misko Hevery
c90abf057b Changed the angular.compile(element)(scope[, cloneAttachNode]) 2011-02-16 08:59:57 -05:00
Misko Hevery
ef4bb28be1 Change API angular.compile(element)([scope], [element/true]) 2011-02-16 01:03:12 -05:00
Misko Hevery
23b255a8b7 remove $init on scope from applying compilation template
Closes #40
2011-02-16 00:49:15 -05:00
Misko Hevery
0a5c00abf8 Add public API to retrieve scope from element. 2011-02-16 00:48:22 -05:00
Misko Hevery
c2f2587a79 fixed example rendering, add tests for it. 2011-01-24 14:23:51 -08:00
Igor Minar
5340d1e0b1 fix for infinite loop in retrieveScope with jQuery + specs
- retrieveScope run into infinite loop if called on DOM tree
  that doesn't contain scope reference (happens only with jQuery)
- added missing specs for retrieveScope function
2011-01-24 14:03:42 -08:00
Misko Hevery
5a8ad8fe32 Closes #170. Corrected the behavior of select when options are ng:repeated
- Delete $postEval method, as it was a hack
2010-12-02 22:45:57 -08:00
Misko Hevery
0499c47270 added ng:switch-when-default; changed $watch to always fire on init. (may be backward incompatible) 2010-11-10 21:01:17 -08:00
Misko Hevery
62c0e5c460 Fix failing tests for ie, and mark elements as ng-widget, ng-directive, and ng-binding 2010-10-27 15:42:46 -07:00
Misko Hevery
2cb9497d02 Fixed issue where compiler would pass in detached text node if previous markup would have removed it. 2010-10-12 21:52:04 -07:00
Misko Hevery
059703495d rename textMarkup to markup 2010-07-30 15:19:43 -07:00
Misko Hevery
bebfbeac0a fixed xhtml compatibility, fix console in chrome 2010-07-20 16:55:32 -07:00
Misko Hevery
b275403465 fix ie for jquery 2010-04-26 17:02:27 -07:00
Misko Hevery
02fa10f93c allow the widget to change structure of the DOM and have the compiler follow the replaced element. 2010-04-26 11:57:33 -07:00
Misko Hevery
4aaec251df all tests pass on IE 2010-04-21 13:29:49 -07:00
Misko Hevery
22d93e0a3b fixes to enable ie 2010-04-20 18:14:13 -07:00
Misko Hevery
713307b650 added ng-eval-order attribute 2010-04-12 16:24:28 -07:00
Misko Hevery
ee327a1f4f few fixes to make tests pass with jquery 2010-04-06 14:04:08 -07:00
Misko Hevery
a80a61839a injection is now working 2010-04-03 17:04:36 -07:00
Misko Hevery
3d36942400 merge 2010-03-24 12:08:48 -07:00
Shyam Seshadri
03ddc4570b Fix parsing bug with strings for - 2010-03-24 10:35:01 -07:00
Misko Hevery
bb98ae14f2 markup now wroks, some refactorings 2010-03-23 14:57:11 -07:00
Misko Hevery
6ff550cfa9 all angular.js directives now work 2010-03-22 21:29:57 -07:00
Misko Hevery
84552f7f8a got few directives working 2010-03-22 13:58:04 -07:00
Misko Hevery
f6664ed7f6 tests fixed, still missing widgets 2010-03-19 22:18:39 -07:00
Misko Hevery
c3eac13aa7 showing off problem to corry 2010-03-19 16:41:22 -07:00
Misko Hevery
be3c7a6670 cleanup work 2010-03-18 17:12:38 -07:00
Misko Hevery
79f868cbca cleanup work 2010-03-18 16:20:02 -07:00
Misko Hevery
509b032089 markup now works 2010-03-18 15:50:14 -07:00
Misko Hevery
df607da0d1 support for templates 2010-03-18 14:43:49 -07:00
Misko Hevery
7634a3ed52 initial revision of new plugable compiler 2010-03-18 12:20:06 -07:00