From 23786aaa9275d507073b979f2c152d8b7efc46b4 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Mon, 2 Mar 2015 09:58:46 +0100 Subject: [PATCH] feat(DomAdapter): add types Closes #842 --- modules/angular2/src/dom/browser_adapter.dart | 8 ++++---- modules/angular2/src/dom/browser_adapter.es6 | 10 +++++----- modules/angular2/src/dom/dom_adapter.js | 10 +++++----- modules/angular2/src/dom/html5lib_adapter.dart | 14 +++++++------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/angular2/src/dom/browser_adapter.dart b/modules/angular2/src/dom/browser_adapter.dart index ddc5dab47b..1be8cbaf4e 100644 --- a/modules/angular2/src/dom/browser_adapter.dart +++ b/modules/angular2/src/dom/browser_adapter.dart @@ -188,8 +188,8 @@ class BrowserDomAdapter extends DomAdapter { Node importIntoDoc(Node node) { return document.importNode(node, true); } - isPageRule(CssRule rule) => rule is CssPageRule; - isStyleRule(CssRule rule) => rule is CssStyleRule; - isMediaRule(CssRule rule) => rule is CssMediaRule; - isKeyframesRule(CssRule rule) => rule is CssKeyframesRule; + bool isPageRule(CssRule rule) => rule is CssPageRule; + bool isStyleRule(CssRule rule) => rule is CssStyleRule; + bool isMediaRule(CssRule rule) => rule is CssMediaRule; + bool isKeyframesRule(CssRule rule) => rule is CssKeyframesRule; } diff --git a/modules/angular2/src/dom/browser_adapter.es6 b/modules/angular2/src/dom/browser_adapter.es6 index 81cf7d9790..144e6de256 100644 --- a/modules/angular2/src/dom/browser_adapter.es6 +++ b/modules/angular2/src/dom/browser_adapter.es6 @@ -17,7 +17,7 @@ export class BrowserDomAdapter extends DomAdapter { return _attrToPropMap; } - query(selector) { + query(selector:string) { return document.querySelector(selector); } querySelector(el, selector:string):Node { @@ -246,16 +246,16 @@ export class BrowserDomAdapter extends DomAdapter { } return result; } - isPageRule(rule) { + isPageRule(rule): boolean { return rule.type === CSSRule.PAGE_RULE; } - isStyleRule(rule) { + isStyleRule(rule): boolean { return rule.type === CSSRule.STYLE_RULE; } - isMediaRule(rule) { + isMediaRule(rule): boolean { return rule.type === CSSRule.MEDIA_RULE; } - isKeyframesRule(rule) { + isKeyframesRule(rule): boolean { return rule.type === CSSRule.KEYFRAMES_RULE; } } diff --git a/modules/angular2/src/dom/dom_adapter.js b/modules/angular2/src/dom/dom_adapter.js index 70e1a2668c..c43c4abe40 100644 --- a/modules/angular2/src/dom/dom_adapter.js +++ b/modules/angular2/src/dom/dom_adapter.js @@ -27,7 +27,7 @@ export class DomAdapter { parse(templateHtml:string) { throw _abstract(); } - query(selector) { + query(selector:string) { throw _abstract(); } querySelector(el, selector:string) { @@ -222,16 +222,16 @@ export class DomAdapter { importIntoDoc(node) { throw _abstract(); } - isPageRule(rule) { + isPageRule(rule): boolean { throw _abstract(); } - isStyleRule(rule) { + isStyleRule(rule): boolean { throw _abstract(); } - isMediaRule(rule) { + isMediaRule(rule): boolean { throw _abstract(); } - isKeyframesRule(rule) { + isKeyframesRule(rule): boolean { throw _abstract(); } } diff --git a/modules/angular2/src/dom/html5lib_adapter.dart b/modules/angular2/src/dom/html5lib_adapter.dart index 0e36f51315..e37ffe4678 100644 --- a/modules/angular2/src/dom/html5lib_adapter.dart +++ b/modules/angular2/src/dom/html5lib_adapter.dart @@ -49,7 +49,7 @@ class Html5LibDomAdapter implements DomAdapter { content(TemplateElement node) { throw 'not implemented'; } - + firstChild(el) => el is NodeList ? el.first : el.firstChild; @@ -166,7 +166,7 @@ class Html5LibDomAdapter implements DomAdapter { getStyle(element, String stylename) { throw 'not implemented'; } - + String tagName(element) => element.localName; attributeMap(element) => element.attributes; @@ -205,7 +205,7 @@ class Html5LibDomAdapter implements DomAdapter { bool isCommentNode(node) { throw 'not implemented'; } - + bool isElementNode(node) => node is Element; bool hasShadowRoot(node) { @@ -214,16 +214,16 @@ class Html5LibDomAdapter implements DomAdapter { importIntoDoc(node) { throw 'not implemented'; } - isPageRule(rule) { + bool isPageRule(rule) { throw 'not implemented'; } - isStyleRule(rule) { + bool isStyleRule(rule) { throw 'not implemented'; } - isMediaRule(rule) { + bool isMediaRule(rule) { throw 'not implemented'; } - isKeyframesRule(rule) { + bool isKeyframesRule(rule) { throw 'not implemented'; } }