On Tue, Feb 23, 2010 at 22:52, bootle <[email protected]> wrote:

> :) ok, I think I expressed it wrongly actually, sorry for that - by
> cloning styles I mean copying the whole appearance of an element,
> including styles inherited from css, not only the style="" property of
> the element which - true - is copied when you use clone() . I also
> copy the 'appearance' of all element's children.
>
> then that would be much more complex
you would need to go through all the element's computed styles and copy them
manually. i think you should decide which styles you want to copy, and then
it could be:

Element.implement({
    'cloneWithStyles' : function(styles){
        var clone = this.clone(), self = this;
        styles.each(function(style){
            clone.setStyle(style,self.getStyle(style));
        });
                return clone;
    }
});

Reply via email to