Re: svn commit: r928451 - /ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl
Posted by
Adam Heath-2 on
Mar 28, 2010; 5:51pm
URL: http://ofbiz.116.s1.nabble.com/Re-svn-commit-r928451-ofbiz-trunk-framework-widget-templates-htmlScreenMacroLibrary-ftl-tp1694238p1694293.html
Adrian Crum wrote:
>> However, upon further reflection, my initial example of
>> wrongness was
>> not correct. Consider when style="h1~h2". The
>> original code would do
>> <p class="h1~h2">, which could be matched in css as
>> p."h1~h2" { }.
>>
>> Now, with this change, the tag will be <h1~h2>, which
>> is very wrong.
>>
>> The question to ask yourself, is: are the widget systems,
>> and their
>> internal helper files, supposed to be general purpose, or
>> are they
>> just to be used by ofbiz? If the latter, then we can
>> do whatever we
>> want with not checking various parameters, as we can just
>> fix all bad
>> uses.
>>
>> However, if the former is the correct answer, then we have
>> to handle,
>> and allow, all possible cases. This change keeps that
>> from occuring.
>
> Checking for the h* styles is OFBiz-specific behavior. You are correct that odd class names will trick the code - but the chances that someone would create a "h1~h2" class are pretty small. In any event, I will revert it.
Checking for the h* styles is fine. If it is documented to that, then
end-users can expect that to occur.
But if the code is also documented as allowing any other specified
style to be encoded as a <p> with a class, then it has to allow any
other value to be used. Including my example of "h1~h2".
Now, if you want, you could use ?matches. Or, use a bunch of || in
the <#if>.