excessive / DOMy

A DOM-like GUI framework for the *awesome* LÖVE framework
Other
32 stars 2 forks source link

[Markup] Value Key #15

Closed karai17 closed 9 years ago

karai17 commented 9 years ago

Should there be a value key, or should value (and sometimes children) simply be the sequential second key? Or perhaps both, with value overriding a sequential value?

-- value key
{ "text", value="Some text", id="important_textbox", class={"class1", "class2"},
    { "text", value="Some child" },
}

-- sequential key
{ "text", "Some text", id="important_textbox", class={"class1", "class2"},
    { "text", "Some child" },
}

-- priority key
{ "text", "Some text", value="This takes priority!", id="important_textbox", class={"class1", "class2"},
    { "text", "Some child" },
}
adrix89 commented 9 years ago

If you can do whatever.value to set it that would make more sense then whatever[2] If you are setting the value with a function then there is no point for an extra value field. Priority override makes sense technically since the important one is the value as that would be changed but maybe it doesn't make sense in terms of clarity.

karai17 commented 9 years ago

Well, it wouldn't be whatever[2], this is strictly for markup. See the above examples. On Jan 15, 2015 3:12 AM, "adrix89" notifications@github.com wrote:

If you can do whatever.value to set it that would make more sense then whatever[2] If you are setting the value with a function then there is no point for an extra value field.

— Reply to this email directly or view it on GitHub https://github.com/karai17/DOMinatrix/issues/15#issuecomment-70052480.

karai17 commented 9 years ago

I've decided to go with the priority bit. You can use either element[2] or element.value to assign a value where element.value takes priority in the case that both are given.