On Apr 29, 11:04 am, Wincent Colaiuta <[EMAIL PROTECTED]> wrote:

> >> %foo[obj, :prefix]
>
> I don't really like it, as it strikes me as slightly incongruous that  
> the _pre_ fix comes _after_ the first argument.

The rationale behind my patch is to replicate the functionality of
dom_id
and dom_class when they are used together.
I find it's much more elegant to write:

%p[record, :prefix]

rather than:

%p{:id => dom_id(record, :prefix), :class =>
dom_class(record, :prefix)}

The fact that the "prefix" comes after the first argument may not suit
everyone's taste, but that's how dom_id and dom_class work.

Nathan: your alternative, i.e.

%foo{:id => :prefix, :class => :prefix}[obj]

results in

<foo class='obj prefix' id='prefix_obj_1'>

instead of

<foo class="prefix_obj" id="prefix_obj_1">

so it is not functionally equivalent (and you're repeating the prefix
twice...)

Olek: if you want to prefix only the id and not the class, your
solution is perfectly fine!
I didn't know about Haml's behavior when both the id attribute is set
and the square brackets
syntax is used, maybe it should go in the documentation.

S.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to