Skip to content

Commit

Permalink
preserveComponentBodyTag
Browse files Browse the repository at this point in the history
  • Loading branch information
Quickcorp committed May 9, 2018
1 parent 52ce510 commit 2b6dc8b
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions QCObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@
'relativeImportPath':'',
'componentsBasePath':'',
'delayForReady':0,
'preserveComponentBodyTag':true,
'basePath':basePath
},
set:function (name,value){
Expand Down Expand Up @@ -866,19 +867,32 @@
for (var attribute in attributenames){
data[attributenames[attribute]] = components[_c].getAttribute('data-'+attributenames[attribute]);
}
Class('ComponentBody',Component,{
name:components[_c].getAttribute('name').toString(),
reload:true
});
var newComponent = New(ComponentBody,{
name:components[_c].getAttribute('name').toString(),
data:data,
templateURI:'{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.html'.replace('{{COMPONENT_NAME}}',components[_c].getAttribute('name').toString()).replace('{{COMPONENTS_BASE_PATH}}',CONFIG.get('componentsBasePath'))
});
newComponent.done = function (){
_buildComponent(this.body.querySelectorAll('component:not([loaded])'));
};
components[_c].append(newComponent);
if (CONFIG.get('preserveComponentBodyTag')){
Class('ComponentBody',Component,{
name:components[_c].getAttribute('name').toString(),
reload:true
});
var newComponent = New(ComponentBody,{
name:components[_c].getAttribute('name').toString(),
data:data,
templateURI:'{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.html'.replace('{{COMPONENT_NAME}}',components[_c].getAttribute('name').toString()).replace('{{COMPONENTS_BASE_PATH}}',CONFIG.get('componentsBasePath'))
});
newComponent.done = function (){
_buildComponent(this.body.querySelectorAll('component:not([loaded])'));
};
components[_c].append(newComponent);
} else {
var newComponent = New(Component,{
name:components[_c].getAttribute('name').toString(),
data:data,
templateURI:'{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.html'.replace('{{COMPONENT_NAME}}',components[_c].getAttribute('name').toString()).replace('{{COMPONENTS_BASE_PATH}}',CONFIG.get('componentsBasePath'))
});
newComponent.done = function (){
_buildComponent(this.body.querySelectorAll('component:not([loaded])'));
};
components[_c]=newComponent.body;

}
components[_c].setAttribute('loaded',true);
}
};
Expand Down

0 comments on commit 2b6dc8b

Please sign in to comment.