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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user