Regarding Set Property and Unset Property

Hi there

My current understanding is :
if any style attribute is set using script then it gets locked on that particular element ...till it is unlocked on that particular element....ie the style attributes are locked at element level.

whereas for state attributes things are different.
a) state:focused can be locked using one element and unlocked using other element(even that belonging to a different application)

b) state : enabled and state:value can be locked by one element and unlocked using other element belonging to same application i.e. they are locked at application level.

I have seen behaviour a).
About b) I am not sure.
Do these i.e. a) and b) look right to ya all.




Answer this question

Regarding Set Property and Unset Property

  • tovarish

    (a) is correct but (b) is not. Both enabled and value are per-element properties, but value is special (like focused) because it retains its current setting even when an animation ends.

    This is because it doesn't make sense to have two things with the focus, but it definitely makes sense to have two or more things enabled / disabled or with different values.

    Please see my blog for more information: http://blogs.msdn.com/ptorr/archive/2006/09/08/746678.aspx



  • ercan_06

    Regarding b)

    The latest spec says in section 7.6.3.4.1 :

    A)
    " For the attributes state:focused , state:enabled , state:value , the value maybe set up in markup using <set>/<animate> or script using Animated Property API and this value will override the value which would otherwise be set by presentation engine.This value shall be reflected immediately to DOM attribute value as well as property block.The value will be hold after animation time interval end and unset property "

    This seems to clearly indicate that for state:focused/state:enabled/state:value , the animated value (markup or script) would be retained.

    Also in the same section ie 7.6.3.4.1 spec says :

    B)
    "The state:enable and state:value attributes have independent global status for each Application. The state:focused attribute has single global status for all applications"

    C)
    "the state:focused turns to false when another element is being focused"


    A) and B) seems to indicate if we have to disable two things belonging to same document/application then we have to do this

    thing1.state.enabled = "false";
    thing1.unsetProperty("state:enabled");
    //after this the value of state:enabled for thing1 should persist as per spec extract A) .
    thing2.state:enabled ="false";
    thing2.unsetProperty("state:enabled");

    similarly A) B) and C) indicate this for state: focused behavior
    thing1.state.focused = "true";
    thing1.unsetProperty("state:focused
    ");
    //after this the value of state:
    focused for thing1 should persist as per spec extract A) .
    thing2.state:
    focused = "true";
    // from C) this will cause the  thing1.state.focused = "false"

    the point is that  "single global status for state:focused "  does not  imply that  only a  single element can have state:focus at one time.
    It is implied only by C).

    Thus  unsetProperty seems to be managing only  the "locking status" for state properties.

    Thus b) in the previous post seems to be true


  • Timmy Dot Net

    Thanks, I get the point.

    Hopefully , the dvd-forum would correct the "english" in the future update of the specification.


  • yoga80

    Here "global status" refers to the fact that the property is "global" amongst all three levels (XML DOM, presentation engine, and script), not that it is "global" amongst all elements. So value and enabled have independent values on every element, whilst focused has a single value across all applications. This makes perfect sense since it is not possible to focus more than one thing at once. Here "each application" translates to "everywhere"; the English in the spec is not always perfect :-|.

    You can determine this through experimentation with HDiSim, although we appear to have a bug that lets you enter text into a disabled input box (but by using animation you can verify that you can toggle enabled on more than one element at a time).



  • Regarding Set Property and Unset Property