On Sat, Jun 29, 2013 at 3:11 PM, Marius Gedminas <mar...@gedmin.as> wrote: > 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?
That might work. And it would avoid the need to check for both keywords. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/groups/opt_out.