On Wed, Mar 5, 2008 at 3:38 AM, Bryce <[EMAIL PROTECTED]> wrote:

>
> But! My brain can make this switch in the majority of cases (like the
> ones you gave, Mislav) but there are two problem-cases that come to
> mind (there might be more or these might be wrong).
>
> Tables:
>
> %table
>  #foo
>
> thead, tbody and tfoot can go here, right?


Yeah. But TR is chosen as implicit tag because it's most common.


> Forms:
>
> %form
>  #foo
>
> What is supposed to be placed there?


DIV. When block elements are allowed in an element, DIV is always the
implicit tag.


> Are these really problem-cases or am I missing something? If they are,
> would Haml error out or just use the next-best-substitute?


Haml would never error out. DIV is fallback for everything. But, where DIV
is not allowed I hand-picked an element among the allowed that is most
common: like TR in TABLE although tbody, thead and tfoot are allowed, and
like TD in TR although TH is also allowed. In SELECT, OPTION and OPTGROUP
are allowed, but the implicit tag is OPTION.

Does it make sense now? It's not really that magical, I think it's actually
very straightforward. Look at the mappings:
http://github.com/mislav/haml/tree/html/lib/haml/precompiler.rb#L90

They read out like "implicit_child => parent_tags" pairs. For instance, SPAN
is implicit child element for any of these:

  p h1 h2 h3 h4 h5 h6 tt i b big small em strong dfn code samp kbd
  var cite abbr acronym sub sup q span bdo a dt pre caption legend address

That is because they only allow inline elements as children, and DIV is
block.

--~--~---------~--~----~------------~-------~--~----~
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