Den torsdagen den 3:e januari 2013 kl. 10:08:47 UTC+1 skrev Jan Honza 
Odvarko:
>
> @Simon:
> 1) It would be a bit better if the first undefined value (the first comma) 
> in valueParts
> is not there, but I don't know how to simply fix it.
>
 Agreed. Maybe manually remove it from `topBlock[curInd]`? (if that exists)

2) I think that if valueParts.length > 2 and all values are 'undefined' the 
> attribute
> should also not be created.
>
I dunno. I kindof expect a concatenation of optional things to always yield 
an attribute. (And I don't see a use-case.)


> Anyway, I like the new feature and I also think we should create a new 
> 'domplate' repo in GIT that contains
> independent module of Domplate so, it can be easily loaded and used in 
> other projects besides of Firebug.
>
> I have created:
> http://code.google.com/p/fbug/issues/detail?id=6174
>
> Honza
>
> On Wednesday, January 2, 2013 6:19:04 PM UTC+1, Simon Lindholm wrote:
>>
>> Honza, did you look at the domplate 
>> change<https://github.com/firebug/firebug/commit/b96a1c5f7c703b8205bd31565fb54629177b7929>I
>>  introduced for fireclosure dom panel titles? Assuming it's deemed 
>> acceptable (not too much of an API change) it would ignore attributes with 
>> value |undefined|, so you could use INPUT({checked: 
>> "$check1|trueOrUndefined"}) or so.
>>
>> Simon
>>
>> Den onsdagen den 2:e januari 2013 kl. 12:50:45 UTC+1 skrev Jan Honza 
>> Odvarko:
>>>
>>> The only workaround that occurs to me is to set the attribute manually 
>>> through DOM API
>>>
>>> var checkOne = true;
>>>
>>> var template = domplate(
>>> {
>>>   tag:
>>>     FORM({name:"resform"},
>>>       BR(),
>>>       INPUT({name:"radiolocator", type: "radio"}),
>>>       SPAN("one"),
>>>       INPUT({name:"radiolocator", type: "radio", class: "two"}),
>>>       SPAN("two")
>>>      ), 
>>> });
>>>
>>>
>>> var node = template.tag.replace({check1:checkOne}, parentNode, template)
>>> ;
>>> if (checkOne)
>>>    node.querySelector(".two").setAttribute("checked", "true");
>>>
>>> ---
>>>
>>> Fixing: Issue 6018 <http://code.google.com/p/fbug/issues/detail?id=6018>: 
>>> Support for IF tag in Domplate is fixed.
>>> would help here I guess
>>>
>>> ---
>>>
>>> Or, we could introduce new rule:
>>> If constructor attribute name begins with "%"* *and the actual value of 
>>> the attribute is true (boolean) a new attribute with the same name (without 
>>> "%") is inserted into the DOM element.
>>>
>>> See all naming rule at the bottom of this page
>>>
>>> http://www.softwareishard.com/blog/planet-mozilla/domplate-examples-part-i/
>>>
>>> Honza
>>>
>>>
>>>
>>> On Wednesday, January 2, 2013 12:16:06 PM UTC+1, Maheeka Jayasuriya 
>>> wrote:
>>>>
>>>> Hi All,
>>>>
>>>> I have an issue in using radio buttons in a form. I want to 
>>>> check/uncheck the radio button based on a variable passed. My code is as 
>>>> follows :
>>>>
>>>> *var checkOne ="false"
>>>>
>>>> var template = domplate(
>>>>   {    
>>>>   tag: 
>>>>     FORM({name:"resform"},
>>>>       BR(),
>>>>       INPUT({name:"radiolocator", type: "radio"}),  
>>>>       SPAN("one"),
>>>>       INPUT({name:"radiolocator", type: "radio"}),
>>>>       SPAN("two")                
>>>>      ), 
>>>> }
>>>> )
>>>> ;
>>>>
>>>> template.tag.replace({check1:checkOne}, parentNode, template);*
>>>>
>>>> In standard html checked attribute inside radio input would itself 
>>>> check the element without considering the value. But here I want to check 
>>>> either radio button "one" or "two" based on the variable "check1". I need 
>>>> to use like INPUT({name:"radiolocator", type:"radio",checked:"$check1"}),
>>>>
>>>> Is there a work around??
>>>>
>>>> Thanks in advance !
>>>>
>>>> Maheeka
>>>>
>>>

-- 
You received this message because you are subscribed to the Google
Groups "Firebug" 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
https://groups.google.com/forum/#!forum/firebug

Reply via email to