javajunky
16 Jan 2007, 11:58 AM
I'm having some 'fun' with the 0.40 alpha, I understand this is 'bleeding edge' so I appreciate I may not get any 'help' on this issue. But really I just want a clarification on how I should expect it to work, I've got some markup in my page along the lines of :
<div id="tools">
Configuration (Config.aspx)
Diagnostics (Diagnose.aspx)
</div>
Which I want to convert to buttons with yui-ext. To do this I thought I could use a DomQuery selector to pull out these links and replace them automatically with buttons or templates or something ?
So I wrote the following basic code:
var tools = getEl('tools');
tools.select('a').each( function(el) {
alert(el.innerHTML);
el.remove();
} );
Expecting to be able to execute the 'el.remove()' and adding to the tools element a new button, however el.remove() fails. When I look with the debugger, this is because the select('a').each is passing a *real* Dom Element [in this case an instance of HTMLAnchorElement] into the callback, rather than a yui-ext Element, type object. Is this correct? The documentation isn't entirely clear on whether this should be the expected behaviour of a CompositeElement or not :( :
Calls the passed function passing (el, this, index) for each element in this composite.
I think I'm most probably doing something wrong, but I would appreciate a comment on whether its the right thing to do, should I be bothering to convert links to buttons, or should I just write out the buttons originally ? [/code]
<div id="tools">
Configuration (Config.aspx)
Diagnostics (Diagnose.aspx)
</div>
Which I want to convert to buttons with yui-ext. To do this I thought I could use a DomQuery selector to pull out these links and replace them automatically with buttons or templates or something ?
So I wrote the following basic code:
var tools = getEl('tools');
tools.select('a').each( function(el) {
alert(el.innerHTML);
el.remove();
} );
Expecting to be able to execute the 'el.remove()' and adding to the tools element a new button, however el.remove() fails. When I look with the debugger, this is because the select('a').each is passing a *real* Dom Element [in this case an instance of HTMLAnchorElement] into the callback, rather than a yui-ext Element, type object. Is this correct? The documentation isn't entirely clear on whether this should be the expected behaviour of a CompositeElement or not :( :
Calls the passed function passing (el, this, index) for each element in this composite.
I think I'm most probably doing something wrong, but I would appreciate a comment on whether its the right thing to do, should I be bothering to convert links to buttons, or should I just write out the buttons originally ? [/code]