3 * A Backbone Model subclass that enforces validation when calling set().
6 (function(Drupal, Backbone) {
7 Drupal.quickedit.BaseModel = Backbone.Model.extend(
8 /** @lends Drupal.quickedit.BaseModel# */ {
12 * @augments Backbone.Model
14 * @param {object} options
15 * Options for the base model-
17 * @return {Drupal.quickedit.BaseModel}
18 * A quickedit base model.
21 this.__initialized = true;
22 return Backbone.Model.prototype.initialize.call(this, options);
26 * Set a value on the model
28 * @param {object|string} key
29 * The key to set a value for.
32 * @param {object} [options]
33 * Options for the model.
36 * The result of `Backbone.Model.prototype.set` with the specified
39 set(key, val, options) {
40 if (this.__initialized) {
41 // Deal with both the "key", value and {key:value}-style arguments.
42 if (typeof key === 'object') {
48 options.validate = true;
51 return Backbone.Model.prototype.set.call(this, key, val, options);