Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested components cause , the component creation of multiple times.. #298

Open
atamer opened this issue Jul 22, 2013 · 7 comments
Open

nested components cause , the component creation of multiple times.. #298

atamer opened this issue Jul 22, 2013 · 7 comments

Comments

@atamer
Copy link

atamer commented Jul 22, 2013

<div data-aura-widget="../js/widgets/accordion">
 
<div data-aura-id="tckninput" data-aura-widget="../js/widgets/input"></div>
</div>

and here is my accordion widget render method

render: function() {
var str = template({tabs: this.nodes });
this.html(str);
return this;
}

and aura starts

var aura = new Aura({debug:'true', logEvents: 'true'});
aura.use('auraexbackbone')
.use('auraexhandlebars')
.use('auraexstep')
.start({widget:"body"}).then(function(){
console.warn('started!');
});

tckninput component created twice and event trigger twice

@atamer
Copy link
Author

atamer commented Jul 22, 2013

I found the problem in component.js aura widgets are searched for whole document

Component.parseList = function(components) {
...
...
core.dom.find(selector, components || 'body').each(function() {
var ns = "aura";
if (appNamespace && (this.getAttribute('data-' + appNamespace +'-component') || this.getAttribute('data-' + appNamespace +'-widget'))) {
ns = appNamespace;
}
var options = parseComponentOptions(this, ns);
list.push({ name: options.name, options: options });
});
};

I want to load these widgets one by one , from root to leaf so I changed this code from

base.dom = {
find: function(selector, context) {
context = context || document;
return $(context).find(selector);
},

to

base.dom = {
find: function(selector, context) {
context = context || document;
if($(context).find(selector).size() > 0){
var children = $(context);
while(true){
var foundSelector = $(children).children(selector);
if(foundSelector.size() > 0){
return foundSelector;
}else{
children = children.children();
}
}
}else{
//null
return $(context).find(selector);
}
},

@atamer
Copy link
Author

atamer commented Jul 22, 2013

looks like working , any idea ?

@sbellity
Copy link
Member

Hey @atamer,

Would you have time to chat directly with me today ?
My Gtalk is [email protected] or you can find me on Freenode : #aurajs

@atamer
Copy link
Author

atamer commented Jul 22, 2013

That would be great pleasure , i will be online on gtalk in 2 hours , is
it appropriate ?
On Jul 22, 2013 6:07 PM, "Stephane Bellity" [email protected]
wrote:

Hey @atamer https://github.com/atamer,

Would you have time to chat directly with me today ?
My Gtalk is [email protected] or you can find me on Freenode : #aurajs


Reply to this email directly or view it on GitHubhttps://github.com//issues/298#issuecomment-21350319
.

@sbellity
Copy link
Member

Yep, just ping me when you are available

@atamer
Copy link
Author

atamer commented Jul 22, 2013

Hi Stephane, i am online now ..

On Mon, Jul 22, 2013 at 6:36 PM, Stephane Bellity
[email protected]:

Yep, just ping me when you are available


Reply to this email directly or view it on GitHubhttps://github.com//issues/298#issuecomment-21352647
.

@addyosmani
Copy link
Member

I was just wondering if you guys had a chance to discuss this further and if so, what the resolutions on the nested components suggestion might have been (just in case others are interested too). If you feel that there's nothing more to add to this issue, let's close 'er :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants