Permalink
Browse files

bug: Registration for components in 'body' failed (_isInDom check pro…

…blem)
  • Loading branch information...
MikeMitterer committed Jul 31, 2015
1 parent 1f21dbc commit 5edd524640f374576540de7b893c1c423ddee714
@@ -333,18 +333,19 @@ class MdlComponentHandler {
bool upgrade = false;
switch(config.selectorType) {
case SelectorType.TAG:
upgrade = baseElement.tagName.toLowerCase() == config.selector;
upgrade = baseElement.tagName.toLowerCase() == config.baseSelector;
break;
case SelectorType.ATTRIBUTE:
upgrade = baseElement.attributes.containsKey(config.selector.replaceAll(new RegExp(r"\[|\]"),""));
upgrade = baseElement.attributes.containsKey(config.baseSelector);
break;
case SelectorType.CLASS:
default:
upgrade = baseElement.classes.contains(config.selector.replaceFirst(".",""));
upgrade = baseElement.classes.contains(config.baseSelector);
}
if(upgrade) {
_logger.warning("Upgrade base-elment: ${queryBaseElement} Class: ${config.classAsString}");
_upgradeElement(baseElement, config);
}
}
@@ -459,7 +460,11 @@ class MdlComponentHandler {
_registerComponent();
if(_isInDom(element)) {
/// body-check calls attached if the element we register is registered for "body"
/// Sample:
/// <body class="demo-page--{{samplename}}" mdl-class="checkDebug : 'debug'">
///
if(element.tagName.toLowerCase() == "body" || _isInDom(element)) {
component.attached();
}
@@ -61,6 +61,9 @@ class MdlConfig<T extends MdlComponent> {
}
}
/// The selector how it is defined in the Component
String get baseSelector => _selector;
/// The higher the priority the later the component will be upgraded.
/// This is important for the ripple-effect. Must be called as last upgrade process
/// Default {priority} is 5, materialRippleConfig sets {priority} to 10
@@ -93,7 +93,7 @@ class MaterialClass extends MdlComponent {
void _init() {
_logger.fine("MaterialClass - init");
_logger.fine("MaterialClass - init $element");
/// Recommended - add SELECTOR as class
element.classes.add(_MaterialClassConstant.WIDGET_SELECTOR);
@@ -125,7 +125,7 @@ class MaterialClass extends MdlComponent {
final ObservableProperty prop = val;
void _setValue(final bool value) {
_logger.warning("_setValue $value in $element");
if(value) {
element.classes.add(classname);
} else {

0 comments on commit 5edd524

Please sign in to comment.