Dart DOM: Add Element attributes setter

BUG=None
TEST=None

Review URL: https://chromereviews.googleplex.com/3526016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@143 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
arv@google.com
2011-10-06 18:48:23 +00:00
parent 0b30a49971
commit 21cc2799ec
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -76,6 +76,7 @@ interface Element extends Node /*, common.NodeSelector, common.ElementTraversal
Element.tag(String tag);
Map<String, String> get attributes();
void set attributes(Map<String, String> value);
ElementList get elements();
@@ -401,11 +401,23 @@ class ElementWrappingImplementation extends NodeWrappingImplementation implement
ElementWrappingImplementation._wrap(ptr) : super._wrap(ptr);
ElementAttributeMap _elementAttributeMap;
_CssClassSet _cssClassSet;
_DataAttributeMap _dataAttributes;
Map<String, String> get attributes() {
return new ElementAttributeMap._wrap(_ptr);
if (_elementAttributeMap === null) {
_elementAttributeMap = new ElementAttributeMap._wrap(_ptr);
}
return _elementAttributeMap;
}
void set attributes(Map<String, String> value) {
Map<String, String> attributes = this.attributes;
attributes.clear();
for (String key in value.getKeys()) {
attributes[key] = value[key];
}
}
ElementList get elements() => new _ChildrenElementList._wrap(_ptr);