skariel/webalchemy — pull request #142 by Iftahh (2014-01-29 22:44:51+00:00)
Title: initialize  cls, att, style from element constructor

Added cls, att, style parameters to Element constructor

NOTE: to achieve same behaviour from the RemoteDocument element method I changed it in a non-backwards compatible way - it had a feature to initialize multiple elements from kwargs but looks like this feature wasn't used and isn't very useful in general IMHO.

This new constructor params allows creating elements and initializing in one line:

x.element('div', 'this is a text', cls="panel warning", att={'data-key':'bla bla'}, style={'width':'50px'})

instead of:
d = x.element('div', 'this is a text')
d.cls.append('panel')
d.cls.append('warning')
d.att({'data-key':'bla bla'})
d.style(width='50px')