Skip to content

Commit d1c3073

Browse files
committed
minor
1 parent 16b7943 commit d1c3073

File tree

6 files changed

+33
-39
lines changed

6 files changed

+33
-39
lines changed

benchmark/lexer_perf.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@ import 'package:angular/core/parser/lexer.dart';
55

66
main() {
77
Lexer lexer = new Lexer();
8-
time('ident', () =>
9-
lexer.call('ctrl foo baz ctrl.foo ctrl.bar ctrl.baz'));
10-
time('ident-path', () =>
11-
lexer.call('a.b a.b.c a.b.c.d a.b.c.d.e.f'));
12-
time('num', () =>
13-
lexer.call('1 23 34 456 12341234 12351235'));
14-
time('num-double', () =>
15-
lexer.call('.0 .1 .12 0.123 0.1234'));
16-
time('string', () =>
17-
lexer.call("'quick brown dog and fox say what'"));
18-
time('string-escapes', () =>
19-
lexer.call("quick '\\' brown \u1234 dog and fox\n\rsay what'"));
8+
time('ident', () => lexer.call('ctrl foo baz ctrl.foo ctrl.bar ctrl.baz'));
9+
time('ident-path', () => lexer.call('a.b a.b.c a.b.c.d a.b.c.d.e.f'));
10+
time('num', () => lexer.call('1 23 34 456 12341234 12351235'));
11+
time('num-double', () => lexer.call('.0 .1 .12 0.123 0.1234'));
12+
time('string', () => lexer.call("'quick brown dog and fox say what'"));
13+
time('string-escapes', () => lexer.call("quick '\\' brown \u1234 dog and fox\n\rsay what'"));
2014
}

lib/animate/module.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@
44
* The [angular.animate](#angular/angular-animate) library makes it easier to build animations
55
* that affect the lifecycle of DOM elements. A useful example of this is animating the
66
* removal of an element from the DOM. In order to do this ideally the
7-
* operation should immediatly execute and manipulate the data model,
7+
* operation should immediately execute and manipulate the data model,
88
* and the framework should handle the actual remove of the DOM element once
9-
* the animation complets. This ensures that the logic and model of the
10-
* application is seperated so that the state of the model can be reasoned
11-
* about without having to wory about future modifications of the model.
9+
* the animation completes. This ensures that the logic and model of the
10+
* application is separated so that the state of the model can be reasoned
11+
* about without having to worry about future modifications of the model.
1212
* This library uses computed css styles to calculate the total duration
1313
* of an animation and handles the addition, removal, and modification of DOM
1414
* elements for block level directives such as `ng-if`, `ng-repeat`,
1515
* `ng-hide`, and more.
1616
*
1717
* To use, install the AnimationModule into your main module:
1818
*
19-
* var module = new Module()
20-
* ..install(new AnimationModule());
19+
* var module = new Module()..install(new AnimationModule());
2120
*
2221
* Once the module has been installed, all block level DOM manipulations will
2322
* be routed through the [CssAnimate] class instead of the
2423
* default [NgAnimate] implementation. This will, in turn,
2524
* perform the tracking, manipulation, and computation for animations.
2625
*
27-
* As an example of how this works, let's walk through what happens whan an
26+
* As an example of how this works, let's walk through what happens when an
2827
* element is added to the DOM. The [CssAnimate] implementation will add the
2928
* `.ng-enter` class to new DOM elements when they are inserted into the DOM
3029
* by a directive and will read the computed style. If there is a
@@ -35,7 +34,7 @@
3534
* precomputed duration) the `.ng-enter` and `.ng-enter-active` classes
3635
* will be removed from the DOM element.
3736
*
38-
* When removing elements from the DOM, a simliar pattern is followed. The
37+
* When removing elements from the DOM, a similar pattern is followed. The
3938
* `.ng-leave` class will be added to an element, the transition and / or
4039
* keyframe animation duration will be computed, and if it is non-zero the
4140
* animation will be run by adding the `.ng-leave-active` class. When
@@ -58,7 +57,7 @@
5857
* Fade out example:
5958
*
6059
* HTML:
61-
* <div class="goodbye" ng-if="ctrl.visible">
60+
* <div class="goodbye" ng-if="visible">
6261
* Goodbye world!
6362
* </div>
6463
*
@@ -71,8 +70,8 @@
7170
* opacity: 0;
7271
* }
7372
*
74-
* This will perform a fade out animation on the 'goodby' div when the
75-
* `ctrl.visible` property goes from `true` to `false`.
73+
* This will perform a fade out animation on the 'goodbye' div when the
74+
* `visible` property goes from `true` to `false`.
7675
*
7776
* The [CssAnimate] will also do optimizations on running animations by
7877
* preventing child DOM animations with the [AnimationOptimizer]. This
@@ -129,11 +128,11 @@ final Logger _logger = new Logger('ng.animate');
129128
* of view construction, and some of the native directives to allow you to add
130129
* and define css transition and keyframe animations for the styles of your
131130
* elements.
132-
*
131+
*
133132
* Example html:
134133
*
135134
* <div ng-if="ctrl.myBoolean" class="my-div">...</div>
136-
*
135+
*
137136
* Example css defining an opacity transition over .5 seconds using the
138137
* `.ng-enter` and `.ng-leave` css classes:
139138
*
@@ -144,7 +143,7 @@ final Logger _logger = new Logger('ng.animate');
144143
* .my-div.ng-enter-active {
145144
* opacity: 1;
146145
* }
147-
*
146+
*
148147
* .my-div.ng-leave {
149148
* transition: all 500ms;
150149
* opacity: 1;

lib/core_dom/event_handler.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ typedef void EventFunction(event);
44

55
/**
66
* [EventHandler] is responsible for handling events bound using on-* syntax
7-
* (i.e. `on-click="ctrl.doSomething();"`). The root of the application has an
7+
* (i.e. `on-click="doSomething();"`). The root of the application has an
88
* EventHandler attached as does every [Component].
99
*
1010
* Events bound within [Component] are handled by EventHandler attached to
@@ -16,12 +16,14 @@ typedef void EventFunction(event);
1616
* Example:
1717
*
1818
* <div foo>
19-
* <button on-click="ctrl.say('Hello');">Button</button>;
19+
* <button on-click="say('Hello');">Button</button>;
2020
* </div>
2121
*
22-
* @Component(selector: '[foo]', publishAs: ctrl)
22+
* @Component(selector: '[foo]')
2323
* class FooController {
24-
* say(String something) => print(something);
24+
* void say(String something) {
25+
* print(something);
26+
* }
2527
* }
2628
*
2729
* When button is clicked, "Hello" will be printed in the console.

lib/core_dom/transcluding_component_factory.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
part of angular.core.dom_internal;
22

3-
@Decorator(
4-
selector: 'content')
3+
@Decorator(selector: 'content')
54
class Content implements AttachAware, DetachAware {
65
final ContentPort _port;
76
final dom.Element _element;
@@ -12,7 +11,7 @@ class Content implements AttachAware, DetachAware {
1211
if (_port == null) return;
1312
_beginComment = _port.content(_element);
1413
}
15-
14+
1615
void detach() {
1716
if (_port == null) return;
1817
_port.detachContent(_beginComment);
@@ -21,24 +20,24 @@ class Content implements AttachAware, DetachAware {
2120

2221
class ContentPort {
2322
dom.Element _element;
24-
var _childNodes = [];
23+
final _childNodes = <dom.Node>[];
2524

2625
ContentPort(this._element);
2726

2827
void pullNodes() {
2928
_childNodes.addAll(_element.nodes);
30-
_element.nodes = [];
29+
_element.nodes.clear();
3130
}
3231

33-
content(dom.Element elt) {
32+
dom.Comment content(dom.Element elt) {
3433
var hash = elt.hashCode;
3534
var beginComment = new dom.Comment("content $hash");
3635

3736
if (_childNodes.isNotEmpty) {
3837
elt.parent.insertBefore(beginComment, elt);
3938
elt.parent.insertAllBefore(_childNodes, elt);
4039
elt.parent.insertBefore(new dom.Comment("end-content $hash"), elt);
41-
_childNodes = [];
40+
_childNodes.clear();
4241
}
4342
elt.remove();
4443
return beginComment;

lib/directive/module.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* For example:
1414
*
15-
* <span ng-show="ctrl.isVisible">this text is conditionally visible</span>
15+
* <span ng-show="isVisible">this text is conditionally visible</span>
1616
*
1717
*/
1818
library angular.directive;

lib/directive/ng_if.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
part of angular.directive;
22

33
/**
4-
* Base class for NgIf and NgUnless.
4+
* Base class for [NgIf] and [NgUnless].
55
*/
66
abstract class _NgUnlessIfAttrDirectiveBase {
77
final BoundViewFactory _boundViewFactory;

0 commit comments

Comments
 (0)