3 * A Backbone Model subclass that enforces validation when calling set().
6 (function (Drupal, Backbone) {
10 Drupal.quickedit.BaseModel = Backbone.Model.extend(/** @lends Drupal.quickedit.BaseModel# */{
15 * @augments Backbone.Model
17 * @param {object} options
18 * Options for the base model-
20 * @return {Drupal.quickedit.BaseModel}
21 * A quickedit base model.
23 initialize: function (options) {
24 this.__initialized = true;
25 return Backbone.Model.prototype.initialize.call(this, options);
29 * Set a value on the model
31 * @param {object|string} key
32 * The key to set a value for.
35 * @param {object} [options]
36 * Options for the model.
39 * The result of `Backbone.Model.prototype.set` with the specified
42 set: function (key, val, options) {
43 if (this.__initialized) {
44 // Deal with both the "key", value and {key:value}-style arguments.
45 if (typeof key === 'object') {
52 options.validate = true;
55 return Backbone.Model.prototype.set.call(this, key, val, options);