style: add more type info to Dart BrowserAdapter

This commit is contained in:
Kevin Moore 2015-04-08 18:11:40 -07:00 committed by Misko Hevery
parent afe5465862
commit 5ce5a87abe
1 changed files with 8 additions and 8 deletions

View File

@ -101,13 +101,13 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
} }
@override @override
final attrToPropMap = const { Map<String, String> get attrToPropMap => const <String, String>{
'innerHtml': 'innerHtml', 'innerHtml': 'innerHtml',
'readonly': 'readOnly', 'readonly': 'readOnly',
'tabindex': 'tabIndex', 'tabindex': 'tabIndex',
}; };
query(String selector) => document.querySelector(selector); Element query(String selector) => document.querySelector(selector);
Element querySelector(el, String selector) => el.querySelector(selector); Element querySelector(el, String selector) => el.querySelector(selector);
@ -124,7 +124,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
} }
MouseEvent createMouseEvent(String eventType) => MouseEvent createMouseEvent(String eventType) =>
new MouseEvent(eventType, canBubble: true); new MouseEvent(eventType, canBubble: true);
createEvent(eventType) => new Event(eventType, canBubble: true); Event createEvent(eventType) => new Event(eventType, canBubble: true);
String getInnerHTML(Element el) => el.innerHtml; String getInnerHTML(Element el) => el.innerHtml;
String getOuterHTML(Element el) => el.outerHtml; String getOuterHTML(Element el) => el.outerHtml;
void setInnerHTML(Element el, String value) { void setInnerHTML(Element el, String value) {
@ -154,7 +154,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
Element remove(Element el) { Element remove(Element el) {
return el..remove(); return el..remove();
} }
insertBefore(Node el, node) { void insertBefore(Node el, node) {
el.parentNode.insertBefore(node, el); el.parentNode.insertBefore(node, el);
} }
void insertAllBefore(Node el, Iterable<Node> nodes) { void insertAllBefore(Node el, Iterable<Node> nodes) {
@ -186,7 +186,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
if (doc == null) doc = document; if (doc == null) doc = document;
return doc.createElement(tagName); return doc.createElement(tagName);
} }
createTextNode(String text, [HtmlDocument doc = null]) { Text createTextNode(String text, [HtmlDocument doc = null]) {
return new Text(text); return new Text(text);
} }
createScriptTag(String attrName, String attrValue, createScriptTag(String attrName, String attrValue,
@ -222,13 +222,13 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
bool hasClass(Element element, String classname) => bool hasClass(Element element, String classname) =>
element.classes.contains(classname); element.classes.contains(classname);
setStyle(Element element, String stylename, String stylevalue) { void setStyle(Element element, String stylename, String stylevalue) {
element.style.setProperty(stylename, stylevalue); element.style.setProperty(stylename, stylevalue);
} }
removeStyle(Element element, String stylename) { void removeStyle(Element element, String stylename) {
element.style.removeProperty(stylename); element.style.removeProperty(stylename);
} }
getStyle(Element element, String stylename) { String getStyle(Element element, String stylename) {
return element.style.getPropertyValue(stylename); return element.style.getPropertyValue(stylename);
} }