luci-base: ui.js: implement AbstractElement.isChanged()
The new `isChanged()` utility functions allows to query the dirty state of an ui input widget. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
c44528d40d
commit
18eddc9624
1 changed files with 15 additions and 0 deletions
|
@ -127,6 +127,21 @@ var UIElement = baseclass.extend(/** @lends LuCI.ui.AbstractElement.prototype */
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the input value was altered by the user.
|
||||||
|
*
|
||||||
|
* @instance
|
||||||
|
* @memberof LuCI.ui.AbstractElement
|
||||||
|
* @returns {boolean}
|
||||||
|
* Returns `true` if the input value has been altered by the user or
|
||||||
|
* `false` if it is unchaged. Note that if the user modifies the initial
|
||||||
|
* value and changes it back to the original state, it is still reported
|
||||||
|
* as changed.
|
||||||
|
*/
|
||||||
|
isChanged: function() {
|
||||||
|
return (this.node ? this.node.getAttribute('data-changed') : null) == 'true';
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the current input value is valid.
|
* Check whether the current input value is valid.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue