blob: 64eeccc58bf220f8c979c61f40f9bf281468f791 [file] [log] [blame]
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class _AttributeClassSet extends _CssClassSet {
_AttributeClassSet(element) : super(element);
String $dom_className() => _element.attributes['class'];
void _write(Set s) {
_element.attributes['class'] = _formatSet(s);
}
}
class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
CSSClassSet get classes {
if (_cssClassSet == null) {
_cssClassSet = new _AttributeClassSet(_ptr);
}
return _cssClassSet;
}
List<Element> get elements => new _FilteredElementList(this);
void set elements(Collection<Element> value) {
final elements = this.elements;
elements.clear();
elements.addAll(value);
}
String get outerHTML {
final container = new Element.tag("div");
final SVGElement cloned = this.clone(true);
container.elements.add(cloned);
return container.innerHTML;
}
String get innerHTML {
final container = new Element.tag("div");
final SVGElement cloned = this.clone(true);
container.elements.addAll(cloned.elements);
return container.innerHTML;
}
void set innerHTML(String svg) {
final container = new Element.tag("div");
// Wrap the SVG string in <svg> so that SVGElements are created, rather than
// HTMLElements.
container.innerHTML = '<svg version="1.1">$svg</svg>';
this.elements = container.elements[0].elements;
}
$!MEMBERS
}