On Fri, Jun 28, 2013 at 02:04:08PM -0700, Mike Orr wrote:
> I'd also like feedback on another idea. I'm thinking about adding arguments
> to build up the class attribute and style attribute piecemeal:
> 
>     make_tag(..., classes=["foo", "bar"])  => ' ... class="foo bar"'
> 
>     make_tag(..., styles=["margin:0", "padding: 1ex"]) => '...
> style="margin:0; padding: 1ex")
> 
> Would this be useful to others?

Yes!

> Would the names collide with any other
> potential attributes? (I don't think so since HTML doesn't define "styles"
> and "classes", and is unlikely to because of user confusion.) Is there a
> better API?

What about

  make_tag(..., style=["margin: 0", "padding: 1ex"])

and

  make_tag(..., class_=["foo", "bar"])

i.e. overload the type of the attribute instead of the name?

> Are there any other attributes where this would be useful on?
> 
> Are there any other syntactic sugar patterns that would be helpful in a
> Javascript-rich or HTML 5 application?

Marius Gedminas
-- 
Any sufficiently advanced technology is indistinguishable from a rigged demo.
- Andy Finkel, computer guy

Attachment: signature.asc
Description: Digital signature

Reply via email to