OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library trydart.decoration; | 5 library trydart.decoration; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 | 8 |
9 import 'shadow_root.dart' show | 9 import 'shadow_root.dart' show |
10 setShadowRoot; | 10 setShadowRoot; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 var element = super.applyTo(text); | 61 var element = super.applyTo(text); |
62 var nodes = new List.from(element.nodes); | 62 var nodes = new List.from(element.nodes); |
63 element.nodes.clear(); | 63 element.nodes.clear(); |
64 var tip = new Text(''); | 64 var tip = new Text(''); |
65 if (kind == 'error') { | 65 if (kind == 'error') { |
66 tip = error(message); | 66 tip = error(message); |
67 } | 67 } |
68 return element..append( | 68 return element..append( |
69 new AnchorElement() | 69 new AnchorElement() |
70 ..classes.add('diagnostic') | 70 ..classes.add('diagnostic') |
71 ..nodes.addAll(nodes) | 71 ..append(tip) |
ahe
2014/06/27 11:23:27
Assume the user have written "foo" and we want to
Johnni Winther
2014/07/02 08:40:53
Put this explanation as comment in the code.
ahe
2014/07/04 13:52:00
Done.
| |
72 ..append(tip)); | 72 ..nodes.addAll(nodes)); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 createAlert(text, [String cls]) { | 76 createAlert(text, [String cls]) { |
77 var classes = ['alert']; | 77 var classes = ['alert']; |
78 if (cls != null) { | 78 if (cls != null) { |
79 classes.add(cls); | 79 classes.add(cls); |
80 } | 80 } |
81 SpanElement result = new SpanElement() | 81 SpanElement result = new SpanElement() |
82 ..classes.addAll(classes) | 82 ..classes.addAll(classes) |
(...skipping 29 matching lines...) Expand all Loading... | |
112 | 112 |
113 Element applyTo(text) { | 113 Element applyTo(text) { |
114 var codeCompletion = new DivElement() | 114 var codeCompletion = new DivElement() |
115 ..contentEditable = 'false' | 115 ..contentEditable = 'false' |
116 ..classes.add('dart-code-completion'); | 116 ..classes.add('dart-code-completion'); |
117 return super.applyTo(text) | 117 return super.applyTo(text) |
118 ..classes.add('dart-code-completion-holder') | 118 ..classes.add('dart-code-completion-holder') |
119 ..nodes.add(codeCompletion); | 119 ..nodes.add(codeCompletion); |
120 } | 120 } |
121 } | 121 } |
OLD | NEW |