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

Unified Diff: pkg/custom_element/lib/custom_element.dart

Issue 24149003: Port of github.com/polymer/polymer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/custom_element/lib/src/attribute_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/custom_element/lib/custom_element.dart
diff --git a/pkg/custom_element/lib/custom_element.dart b/pkg/custom_element/lib/custom_element.dart
index 2912a2efbaed10aca8810cfdfcecc94eff7291f6..19824cf840c6c1172deda42ff1263dddb37cbbec 100644
--- a/pkg/custom_element/lib/custom_element.dart
+++ b/pkg/custom_element/lib/custom_element.dart
@@ -23,6 +23,8 @@ import 'package:mdv/mdv.dart' as mdv;
import 'package:meta/meta.dart';
import 'src/custom_tag_name.dart';
+part 'src/attribute_map.dart';
+
// TODO(jmesserly): replace with a real custom element polyfill.
// This is just something temporary.
/**
@@ -115,6 +117,7 @@ class CustomElement implements Element {
/** The web component element wrapped by this class. */
Element _host;
List _shadowRoots;
+ _AttributeMap _attributes;
/**
* Shadow roots generated by dwc for each custom element, indexed by the
@@ -185,10 +188,8 @@ class CustomElement implements Element {
@deprecated
void leftView() {}
- // TODO(jmesserly): how do we implement this efficiently?
- // See https://github.com/dart-lang/web-ui/issues/37
/** Invoked when any attribute of the component is modified. */
- void attributeChanged(String name, String oldValue, String newValue) {}
+ void attributeChanged(String name, String oldValue) {}
get model => host.model;
@@ -275,9 +276,12 @@ class CustomElement implements Element {
Node insertAllBefore(Iterable<Node> newChild, Node refChild) =>
host.insertAllBefore(newChild, refChild);
- Map<String, String> get attributes => host.attributes;
+ Map<String, String> get attributes {
+ if (_attributes == null) _attributes = new _AttributeMap(this);
+ return _attributes;
+ }
set attributes(Map<String, String> value) {
- host.attributes = value;
+ (attributes as _AttributeMap)._replaceAll(value);
}
List<Element> get elements => host.children;
@@ -319,10 +323,7 @@ class CustomElement implements Element {
String get nodeValue => host.nodeValue;
- @deprecated
- // TODO(sigmund): restore the old return type and call host.on when
- // dartbug.com/8131 is fixed.
- dynamic get on { throw new UnsupportedError('on is deprecated'); }
+ Events get on => host.on;
String get contentEditable => host.contentEditable;
set contentEditable(String v) { host.contentEditable = v; }
« no previous file with comments | « no previous file | pkg/custom_element/lib/src/attribute_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698