Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: pkg/mdv/lib/src/element.dart

Issue 22340002: fix issue 12190 -- better error message (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of mdv; 5 part of mdv;
6 6
7 /** Extensions to the [Element] API. */ 7 /** Extensions to the [Element] API. */
8 class _ElementExtension extends _NodeExtension { 8 class _ElementExtension extends _NodeExtension {
9 _ElementExtension(Element node) : super(node); 9 _ElementExtension(Element node) : super(node);
10 10
11 // TODO(jmesserly): should path be optional, and default to empty path? 11 // TODO(jmesserly): should path be optional, and default to empty path?
12 // It is used that way in at least one path in JS TemplateElement tests 12 // It is used that way in at least one path in JS TemplateElement tests
13 // (see "BindImperative" test in original JS code). 13 // (see "BindImperative" test in original JS code).
14 NodeBinding createBinding(String name, model, String path) => 14 NodeBinding createBinding(String name, model, String path) =>
15 new _AttributeBinding(node, name, model, path); 15 new _AttributeBinding(node, name, model, path);
16
17 // Normally we issue this error in Element._ensureTemplate, but we
18 // avoid calling that from the model getter, so issue the error here.
19 get model => throw new UnsupportedError('$node is not a template.');
16 } 20 }
17 21
18 class _AttributeBinding extends NodeBinding { 22 class _AttributeBinding extends NodeBinding {
19 final bool conditional; 23 final bool conditional;
20 24
21 _AttributeBinding._(node, name, model, path, this.conditional) 25 _AttributeBinding._(node, name, model, path, this.conditional)
22 : super(node, name, model, path); 26 : super(node, name, model, path);
23 27
24 factory _AttributeBinding(Element node, name, model, path) { 28 factory _AttributeBinding(Element node, name, model, path) {
25 bool conditional = name.endsWith('?'); 29 bool conditional = name.endsWith('?');
(...skipping 13 matching lines...) Expand all
39 } else { 43 } else {
40 node.xtag.attributes.remove(property); 44 node.xtag.attributes.remove(property);
41 } 45 }
42 } else { 46 } else {
43 // TODO(jmesserly): escape value if needed to protect against XSS. 47 // TODO(jmesserly): escape value if needed to protect against XSS.
44 // See https://github.com/polymer-project/mdv/issues/58 48 // See https://github.com/polymer-project/mdv/issues/58
45 node.xtag.attributes[property] = sanitizeBoundValue(value); 49 node.xtag.attributes[property] = sanitizeBoundValue(value);
46 } 50 }
47 } 51 }
48 } 52 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698