Index: lib/custom_element.dart |
diff --git a/lib/custom_element.dart b/lib/custom_element.dart |
index d493e4e09820854ebf0cffd2296bc2c45459d474..59df56a7ac3a9f332e9d456810ee4237fbed7810 100644 |
--- a/lib/custom_element.dart |
+++ b/lib/custom_element.dart |
@@ -48,7 +48,7 @@ void registerCustomElement(String localName, CustomElement create()) { |
// Initialize elements already on the page. |
for (var query in [localName, '[is=$localName]']) { |
for (var element in document.queryAll(query)) { |
- _initCustomElement(element, create); |
+ _initCustomElement(element, localName, create); |
} |
} |
} |
@@ -122,14 +122,6 @@ abstract class CustomElement implements Element { |
getShadowRoot(String componentName) => _generatedRoots[componentName]; |
- /** Any CSS selector (class, id or element) defined name to mangled name. */ |
- ScopedCssMapper _mapper = new ScopedCssMapper({}); |
- |
- // TODO(terry): Add a mapper per component in the type hierarchy. |
- ScopedCssMapper getScopedCss(String componentName) => _mapper; |
- void setScopedCss(String componentName, ScopedCssMapper mapper) { |
- _mapper = mapper; |
- } |
/** |
* *Warning*: This is an implementation helper for Custom Elements and |
@@ -187,15 +179,6 @@ abstract class CustomElement implements Element { |
/** Invoked when any attribute of the component is modified. */ |
void attributeChanged(String name, String oldValue, String newValue) {} |
- /** |
- * **Note**: This is an implementation helper and should not need to be calle |
- * from your code. |
- * |
- * Initializes the contents of the ShadowRoot from template inside the |
- * `<element>` element. |
- */ |
- void initShadow() {} |
- |
get model => host.model; |
void set model(newModel) { |
@@ -624,29 +607,6 @@ abstract class CustomElement implements Element { |
} |
} |
-/** |
- * Maps CSS selectors (class and) to a mangled name and maps x-component name |
- * to [is='x-component']. |
- */ |
-class ScopedCssMapper { |
- final Map<String, String> _mapping; |
- |
- ScopedCssMapper(this._mapping); |
- |
- /** Returns mangled name of selector sans . or # character. */ |
- String operator [](String selector) => _mapping[selector]; |
- |
- /** Returns mangled name of selector w/ . or # character. */ |
- String getSelector(String selector) { |
- var prefixedName = this[selector]; |
- var selectorType = selector[0]; |
- if (selectorType == '.' || selectorType == '#') { |
- return '$selectorType${prefixedName}'; |
- } |
- |
- return prefixedName; |
- } |
-} |
typedef DocumentFragmentCreated(DocumentFragment fragment); |
@@ -657,21 +617,22 @@ void _createElements(Node node) { |
_createElements(c); |
} |
if (node is Element) { |
- var ctor = _customElements[node.localName]; |
+ var name = node.localName; |
+ var ctor = _customElements[name]; |
if (ctor == null) { |
- var isAttr = node.attributes['is']; |
- if (isAttr != null) ctor = _customElements[isAttr]; |
+ name = node.attributes['is']; |
+ if (name != null) ctor = _customElements[name]; |
} |
- if (ctor != null) _initCustomElement(node, ctor); |
+ if (ctor != null) _initCustomElement(node, name, ctor); |
} |
} |
-void _initCustomElement(Element node, CustomElement ctor()) { |
+void _initCustomElement(Element node, String localName, CustomElement ctor()) { |
Jennifer Messerly
2013/07/18 23:56:04
do we need this arg?
Siggi Cherem (dart-lang)
2013/07/19 22:52:52
oops, not anymore =) I removed the use of it, but
|
CustomElement element = ctor(); |
element.host = node; |
// TODO(jmesserly): replace lifecycle stuff with a proper polyfill. |
- element..initShadow()..created(); |
+ element.created(); |
_registerLifecycleInsert(element); |
} |