from bug 271720 nsXFormsControlStubBase::ResetBoundNode() does: nsCOMPtr<nsIXTFElementWrapper> xtfWrap(do_QueryInterface(mElement)); NS_ENSURE_STATE(xtfWrap); xtfWrap->SetIntrinsicState(NS_EVENT_STATE_DISABLED); to disable a node. That's actually wrong. That only makes it match :disabled, and _no_ other pseudo classes. We need to make it match the other pseudo classes too I guess. We need a nsXFormsUtils::DisableControl(nsIDOMElement *aElement). Upload (bug 275453) needs it too.
From the spec: "The binding expression is evaluated to ensure that it points to a node that exists. If this is not the case then the form control should behave in the same manner as if it had bound to a model item with the relevant model item property resolved to false." It only mentions the relevant MIP.
Hmm, this is more tricky than I originally thought. A control can have these states: 1) Not attached to model (no model in doc. or wrong @model) 2) Attached to model, but have no node binding 3) Attached to model, but have node binding pointing to /dev/null 4) Bound to model and have bound node (and there is also the special case where the relevant property can be overriden by the control, if is bound to a node of the wrong type. For upload, that's bug 329376) 1) is a fatal error, and can be ignored 4) is clearly defined But 2) and 3) needs a definition of what are the "standard" states for a control. For 2) it should be enabled, and 3) it should be disabled, but for the rest of the states? My guess is: read-write, optional, and valid, as these are the default MIP states if nothing else is defined.
Created attachment 218694 [details] [diff] [review] Patch * nsXFormsControlStub::ResetBoundNode() disables the control if it has a valid binding pointing to /dev/null. It uses mAppearDisabled for this. * The model now always sets the states, no matter if there is a bound node or not, to handle default state. * nsXFormsControlStub::Refresh() triggers nsIModelElementPrivate->SetStates(), instead of the model doing so. (should take care of bug 300591 comment 4) * Bind() returns NS_OK_XFORMS_DEFERRED if the binding was deferred * nsXFormsOutputElement() is greatly simplified, and now stores the string result during Bind(), which is more accurate. (this cleanup also fixes bug 330396) * nsXFormsUtils::EvaluateXPath now returns nsresult, to actually catch errors
Comment on attachment 218694 [details] [diff] [review] Patch looks good, r=me
Fixed on trunk
*** Bug 330396 has been marked as a duplicate of this bug. ***