UIChangeableProperty
This commit is contained in:
parent
1c317f5134
commit
16719e1d07
|
@ -366,6 +366,23 @@ function splitClassValue(v) {
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
spawn named 'UIChangeablePropertyFactory' {
|
||||
during Observe(P.UIChangeableProperty($selector, $property, _))
|
||||
spawn named ['UIChangeableProperty', selector, property] {
|
||||
on start selectorMatch(document, selector).forEach((node) => {
|
||||
react {
|
||||
field this.value = node[property];
|
||||
assert P.UIChangeableProperty(selector, property, this.value);
|
||||
const handlerClosure = Dataspace.wrapExternal((e) => { this.value = node[property]; });
|
||||
on start eventUpdater('change', handlerClosure, true)(node);
|
||||
on stop eventUpdater('change', handlerClosure, false)(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function escapeDataAttributeName(s) {
|
||||
// Per https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset,
|
||||
// the rules seem to be:
|
||||
|
|
|
@ -63,6 +63,11 @@ module.exports.UIAttribute = UIAttribute;
|
|||
assertion type UIProperty(selector, property, value);
|
||||
module.exports.UIProperty = UIProperty;
|
||||
|
||||
// Assertion. For clients to monitor the values of properties that,
|
||||
// when changed, emit 'change' events.
|
||||
assertion type UIChangeableProperty(selector, property, value);
|
||||
module.exports.UIChangeableProperty = UIChangeableProperty;
|
||||
|
||||
// Messages.
|
||||
// NOTE: These do not treat "class" specially!
|
||||
message type SetAttribute(selector, attribute, value);
|
||||
|
|
Loading…
Reference in New Issue