Comparing version 1.2.0 to 1.3.0
@@ -0,0 +0,0 @@ Thanks for contributing :+1: |
@@ -0,0 +0,0 @@ Thanks for contributing :-) |
{ | ||
"name": "persisto", | ||
"description": "Persist Javascript objects to localStorage and remote servers.", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": [ | ||
@@ -6,0 +6,0 @@ "dist/persisto.js" |
@@ -1,2 +0,11 @@ | ||
# 1.2.1-0 / Unreleased | ||
# 1.3.1-0 / Unreleased | ||
# 1.3.0 / 2020-09-11 | ||
* [Changed] jQuery is now a peerDependency (>=1.12), so users can install or | ||
re-use their own version. | ||
* [FIX] #3: `writeToForm()` skips input elements of type 'file', because setting | ||
these values would raise an exception. | ||
* [FIX] #6: `writeToForm()` handles complex input names. | ||
* Update to jQuery 3.5.1 and Qunit 2.11 | ||
# 1.2.0 / 2019-09-07 | ||
@@ -3,0 +12,0 @@ * [ADD] AMD wrapper and module support (`persisto = require('persisto')`). |
@@ -0,0 +0,0 @@ Copyright 2016-2017 Martin Wendt, |
@@ -9,4 +9,4 @@ /*! | ||
* | ||
* @version 1.2.0 | ||
* @date 2019-09-07T13:47:35Z | ||
* @version 1.3.0 | ||
* @date 2020-09-11T15:59:42Z | ||
*/ | ||
@@ -46,6 +46,6 @@ | ||
/* jshint ignore:start */ if (!(this instanceof PersistentObject)) { | ||
// eslint-disable-next-line no-undef | ||
if (!(this instanceof PersistentObject)) { | ||
error("Must use 'new' keyword"); | ||
} | ||
/* jshint ignore:end */ | ||
@@ -109,4 +109,8 @@ if (typeof namespace !== "string") { | ||
self.offline = true; | ||
if (prevValue != null) { | ||
if (prevValue == null) { | ||
console.warn( | ||
self + ": could not init from remote; falling back default." | ||
); | ||
} else { | ||
console.warn( | ||
self + ": could not init from remote; falling back to storage." | ||
@@ -120,9 +124,6 @@ ); | ||
); | ||
} else { | ||
console.warn( | ||
self + ": could not init from remote; falling back default." | ||
); | ||
} | ||
dfd.resolve(); | ||
}); | ||
// eslint-disable-next-line no-negated-condition | ||
} else if (prevValue != null) { | ||
@@ -144,3 +145,3 @@ this.update(); | ||
/** @type {string} */ | ||
version: "1.2.0", // Set to semver by 'grunt release' | ||
version: "1.3.0", // Set to semver by 'grunt release' | ||
@@ -161,3 +162,5 @@ /* Trigger commit/push according to current settings. */ | ||
if (!deferredCall) { | ||
if (deferredCall) { | ||
this.debug("_invalidate() recursive"); | ||
} else { | ||
// this.debug("_invalidate(" + hint + ")"); | ||
@@ -172,4 +175,2 @@ this.lastModified = now; | ||
this.opts.change(hint); | ||
} else { | ||
this.debug("_invalidate() recursive"); | ||
} | ||
@@ -355,4 +356,3 @@ | ||
setDirty: function(flag) { | ||
if (flag === false) { | ||
} else { | ||
if (flag !== false) { | ||
this._invalidate("explicit"); | ||
@@ -531,6 +531,8 @@ } | ||
writeToForm: function(form, options) { | ||
var $form = $(form); | ||
var $form = $(form), | ||
self = this; | ||
$.each(this._data, function(k, v) { | ||
var $input = $form.find("[name='" + k + "']"), | ||
$.each(this._data, function(k) { | ||
var v = self.get(k), | ||
$input = $form.find("[name='" + k + "']"), | ||
type = $input.attr("type"); | ||
@@ -563,2 +565,4 @@ | ||
}); | ||
} else if (type === "file") { | ||
// #3 skip type=file | ||
} else { | ||
@@ -565,0 +569,0 @@ $input.val(v); |
@@ -1,4 +0,4 @@ | ||
/*! Persistent JavaScript objects and web forms using Web Storage. - v1.2.0 - 2019-09-07 | https://github.com/mar10/persisto | Copyright (c) 2019 Martin Wendt; Licensed MIT */ | ||
/*! Persistent JavaScript objects and web forms using Web Storage. - v1.3.0 - 2020-09-11 | https://github.com/mar10/persisto | Copyright (c) 2020 Martin Wendt; Licensed MIT */ | ||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";var b=9007199254740991,c=window.console,d=a.error;return window.PersistentObject=function(b,e){var f,g=this,h=a.Deferred(),i=Date.now();this instanceof PersistentObject||d("Must use 'new' keyword"),"string"!=typeof b&&d(this+": Missing required argument: namespace"),this.opts=a.extend({remote:null,defaults:{},commitDelay:500,createParents:!0,maxCommitDelay:3e3,pushDelay:5e3,maxPushDelay:3e4,storage:window.localStorage,debugLevel: 1,change:a.noop,commit:a.noop,conflict:a.noop,error:a.noop,pull:a.noop,push:a.noop,update:a.noop},e),this._checkTimer=null,this.namespace=b,this.storage=this.opts.storage,this._data=this.opts.defaults,this.offline=void 0,this.phase=null,this.uncommittedSince=null,this.unpushedSince=null,this.lastUpdate=0,this.lastPull=0,this.commitCount=0,this.pushCount=0,this.lastModified=i,this.ready=h.promise,f=this.storage?this.storage.getItem(this.namespace):null,this.opts.remote?this.pull().done(function(){g.offline=!1,h.resolve()}).fail(function(){g.offline=!0,null!=f?(c.warn(g+": could not init from remote; falling back to storage."),g._data=a.extend({},g.opts.defaults,JSON.parse(f))):c.warn(g+": could not init from remote; falling back default."),h.resolve()}):null!=f?(this.update(),this._data=a.extend({},this.opts.defaults,this._data),h.resolve()):h.resolve()},window.PersistentObject.prototype={version:"1.2.0",_invalidate:function(a,c){var d=this,e=this.lastModified,f=Date.now(),g=0,h=0,i=0;this._checkTimer&&(clearTimeout(this._checkTimer),this._checkTimer=null),c?this.debug("_invalidate() recursive"):(this.lastModified=f,this.uncommittedSince||(this.uncommittedSince=f),this.unpushedSince||(this.unpushedSince=f),this.opts.change(a)),this.storage&&(f-e>=this.opts.commitDelay||f-this.uncommittedSince>=this.opts.maxCommitDelay?(this.debug("_invalidate(): force commit",f-e>=this.opts.commitDelay,f-this.uncommittedSince>=this.opts.maxCommitDelay),this.commit()):g=Math.min(f+this.opts.commitDelay+1,this.uncommittedSince+this.opts.maxCommitDelay+1)),this.opts.remote&&(f-e>=this.opts.pushDelay||f-this.unpushedSince>=this.opts.maxPushDelay?(this.debug("_invalidate(): force push",f-e>=this.opts.pushDelay,f-this.unpushedSince>=this.opts.maxPushDelay),this.push()):h=Math.min(f+this.opts.pushDelay+1,this.unpushedSince+this.opts.maxPushDelay+1)),(g||h)&&(i=Math.min(g||b,h||b),this.debug("_invalidate("+a+") defer by "+(i-f)+"ms"),this._checkTimer=setTimeout(function(){d._checkTimer=null,d._invalidate.call(d,null,!0)},i-f))},_update:function(a){this.uncommittedSince&&(c.warn("Updating an uncommitted object."),this.conflict(a,this._data)===!1)||(this._data=a,this.lastUpdate=Date.now())},toString:function(){return"PersistentObject('"+this.namespace+"')"},debug:function(){this.opts.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),c.log.apply(c,arguments))},log:function(){this.opts.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),c.log.apply(c,arguments))},isDirty:function(){return!!(this.storage&&this.uncommittedSince||this.opts.remote&&this.unpushedSince)},isReady:function(){return"pending"!==this.ready.state},get:function(a){var b,c=this._data,e=(""+a).replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");for(b=0;b<e.length;b++)c=c[e[b]],void 0===c&&b<e.length-1&&d(this+": Property '"+a+"' could not be accessed because parent '"+e.slice(0,b+1).join(".")+"' does not exist");return c},_setOrRemove:function(a,b,c){var e,f,g=this._data,h=(""+a).replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=h.pop();for(e=0;e<h.length;e++)f=g,g=f[h[e]],void 0===g&&(this.opts.createParents?(this.debug("Creating intermediate parent '"+h[e]+"'"),g=f[h[e]]={}):d(this+": Property '"+a+"' could not be set because parent '"+h.slice(0,e+1).join(".")+"' does not exist"));g[i]!==b&&(c===!0?(delete g[i],this._invalidate("remove")):(g[i]=b,this._invalidate("set")))},set:function(a,b){return this._setOrRemove(a,b,!1)},remove:function(a){return this._setOrRemove(a,void 0,!0)},reset:function(a){this._data=a||{},this._invalidate("reset")},setDirty:function(a){a===!1||this._invalidate("explicit")},update:function(){this.phase&&d(this+": Trying to update while '"+this.phase+"' is pending."),this.opts.debugLevel>=2&&c.time&&c.time(this+".update");var a=this.storage.getItem(this.namespace);a=JSON.parse(a),this._update(a),this.opts.debugLevel>=2&&c.time&&c.timeEnd(this+".update")},commit:function(){var a;return this.phase&&d(this+": Trying to commit while '"+this.phase+"' is pending."),this.opts.debugLevel>=2&&c.time&&c.time(this+".commit"),a=JSON.stringify(this._data),this.storage.setItem(this.namespace,a),this.uncommittedSince=null,this.commitCount+=1,this.opts.debugLevel>=2&&c.time&&c.timeEnd(this+".commit"),a},pull:function(){var b=this;return this.phase&&d(this+": Trying to pull while '"+this.phase+"' is pending."),this.opts.debugLevel>=2&&c.time&&c.time(this+".pull"),this.phase="pull",a.ajax({type:"GET",url:this.opts.remote}).done(function(c){var d=c;a.isArray(c)||a.isPlainObject(c)?d=JSON.stringify(c):c=JSON.parse(c),b.storage.setItem(b.namespace,d),b._update(c),b.lastPull=Date.now()}).fail(function(){b.opts.error(arguments)}).always(function(){b.phase=null,b.opts.debugLevel>=2&&c.time&&c.timeEnd(b+".pull")})},push:function(){var b=this,e=this.commit();return this.phase&&d(this+": Trying to push while '"+this.phase+"' is pending."),this.opts.debugLevel>=2&&c.time&&c.time(b+".push"),this.phase="push",this.opts.remote||d(this+": Missing remote option"),a.ajax({type:"PUT",url:this.opts.remote,data:e}).done(function(){b.unpushedSince=null,b.pushCount+=1}).fail(function(){b.opts.error(arguments)}).always(function(){b.phase=null,b.opts.debugLevel>=2&&c.time&&c.timeEnd(b+".push")})},readFromForm:function(b,c){var d=this,e=a(b),f=a.extend({addNew:!1,coerce:!0,trim:!0},c);f.addNew&&e.find("[name]").each(function(){var b=a(this).attr("name");void 0===d._data[b]&&(d.debug("readFromForm: add field '"+b+"'"),d._data[b]=null)}),a.each(this._data,function(b,c){var g,h=e.find("[name='"+b+"']"),i=h.attr("type");return h.length?("radio"===i?g=h.filter(":checked").val():"checkbox"===i&&1===h.length?g=!!h.filter(":checked").length:"checkbox"===i&&h.length>1?(g=[],h.filter(":checked").each(function(){g.push(a(this).val())})):(g=h.val(),f.trim&&"string"==typeof g&&(g=a.trim(g))),void d.set(b,g)):void d.debug("readFromForm: field not found: '"+b+"'")})},writeToForm:function(b,c){var d=a(b);a.each(this._data,function(b,c){var e=d.find("[name='"+b+"']"),f=e.attr("type");e.length&&("radio"===f?e.filter("[value='"+c+"']").prop("checked",!0):"checkbox"===f?1===e.length?e.prop("checked",!!c):e.each(function(){a(this).prop("checked",a.isArray(c)?a.inArray(this.value,c)>=0:this.value===c)}):e.is("select")?e.find("option").each(function(){a(this).prop("selected",a.isArray(c)?a.inArray(this.value,c)>=0:this.value===c)}):e.val(c))})}},window.PersistentObject}); | ||
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(r){"use strict";var u=9007199254740991,a=window.console,l=r.error;return window.PersistentObject=function(t,e){var i,s=this,n=r.Deferred(),o=Date.now();this instanceof PersistentObject||l("Must use 'new' keyword"),"string"!=typeof t&&l(this+": Missing required argument: namespace"),this.opts=r.extend({remote:null,defaults:{},commitDelay:500,createParents:!0,maxCommitDelay:3e3,pushDelay:5e3,maxPushDelay:3e4,storage:window.localStorage,debugLevel: 1,change:r.noop,commit:r.noop,conflict:r.noop,error:r.noop,pull:r.noop,push:r.noop,update:r.noop},e),this._checkTimer=null,this.namespace=t,this.storage=this.opts.storage,this._data=this.opts.defaults,this.offline=void 0,this.phase=null,this.uncommittedSince=null,this.unpushedSince=null,this.lastUpdate=0,this.lastPull=0,this.commitCount=0,this.pushCount=0,this.lastModified=o,this.ready=n.promise,i=this.storage?this.storage.getItem(this.namespace):null,this.opts.remote?this.pull().done(function(){s.offline=!1,n.resolve()}).fail(function(){s.offline=!0,null==i?a.warn(s+": could not init from remote; falling back default."):(a.warn(s+": could not init from remote; falling back to storage."),s._data=r.extend({},s.opts.defaults,JSON.parse(i))),n.resolve()}):(null!=i&&(this.update(),this._data=r.extend({},this.opts.defaults,this._data)),n.resolve())},window.PersistentObject.prototype={version:"1.3.0",_invalidate:function(t,e){var i=this,s=this.lastModified,n=Date.now(),o=0,a=0,h=0;this._checkTimer&&(clearTimeout(this._checkTimer),this._checkTimer=null),e?this.debug("_invalidate() recursive"):(this.lastModified=n,this.uncommittedSince||(this.uncommittedSince=n),this.unpushedSince||(this.unpushedSince=n),this.opts.change(t)),this.storage&&(n-s>=this.opts.commitDelay||n-this.uncommittedSince>=this.opts.maxCommitDelay?(this.debug("_invalidate(): force commit",n-s>=this.opts.commitDelay,n-this.uncommittedSince>=this.opts.maxCommitDelay),this.commit()):o=Math.min(n+this.opts.commitDelay+1,this.uncommittedSince+this.opts.maxCommitDelay+1)),this.opts.remote&&(n-s>=this.opts.pushDelay||n-this.unpushedSince>=this.opts.maxPushDelay?(this.debug("_invalidate(): force push",n-s>=this.opts.pushDelay,n-this.unpushedSince>=this.opts.maxPushDelay),this.push()):a=Math.min(n+this.opts.pushDelay+1,this.unpushedSince+this.opts.maxPushDelay+1)),(o||a)&&(h=Math.min(o||u,a||u),this.debug("_invalidate("+t+") defer by "+(h-n)+"ms"),this._checkTimer=setTimeout(function(){i._checkTimer=null,i._invalidate.call(i,null,!0)},h-n))},_update:function(t){this.uncommittedSince&&(a.warn("Updating an uncommitted object."),!1===this.conflict(t,this._data))||(this._data=t,this.lastUpdate=Date.now())},toString:function(){return"PersistentObject('"+this.namespace+"')"},debug:function(){2<=this.opts.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),a.log.apply(a,arguments))},log:function(){1<=this.opts.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),a.log.apply(a,arguments))},isDirty:function(){return!!(this.storage&&this.uncommittedSince||this.opts.remote&&this.unpushedSince)},isReady:function(){return"pending"!==this.ready.state},get:function(t){var e,i=this._data,s=(""+t).replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");for(e=0;e<s.length;e++)void 0===(i=i[s[e]])&&e<s.length-1&&l(this+": Property '"+t+"' could not be accessed because parent '"+s.slice(0,e+1).join(".")+"' does not exist");return i},_setOrRemove:function(t,e,i){var s,n,o=this._data,a=(""+t).replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),h=a.pop();for(s=0;s<a.length;s++)void 0===(o=(n=o)[a[s]])&&(this.opts.createParents?(this.debug("Creating intermediate parent '"+a[s]+"'"),o=n[a[s]]={}):l(this+": Property '"+t+"' could not be set because parent '"+a.slice(0,s+1).join(".")+"' does not exist"));o[h]!==e&&(!0===i?(delete o[h],this._invalidate("remove")):(o[h]=e,this._invalidate("set")))},set:function(t,e){return this._setOrRemove(t,e,!1)},remove:function(t){return this._setOrRemove(t,void 0,!0)},reset:function(t){this._data=t||{},this._invalidate("reset")},setDirty:function(t){!1!==t&&this._invalidate("explicit")},update:function(){this.phase&&l(this+": Trying to update while '"+this.phase+"' is pending."),2<=this.opts.debugLevel&&a.time&&a.time(this+".update");var t=this.storage.getItem(this.namespace);t=JSON.parse(t),this._update(t),2<=this.opts.debugLevel&&a.time&&a.timeEnd(this+".update")},commit:function(){var t;return this.phase&&l(this+": Trying to commit while '"+this.phase+"' is pending."),2<=this.opts.debugLevel&&a.time&&a.time(this+".commit"),t=JSON.stringify(this._data),this.storage.setItem(this.namespace,t),this.uncommittedSince=null,this.commitCount+=1,2<=this.opts.debugLevel&&a.time&&a.timeEnd(this+".commit"),t},pull:function(){var i=this;return this.phase&&l(this+": Trying to pull while '"+this.phase+"' is pending."),2<=this.opts.debugLevel&&a.time&&a.time(this+".pull"),this.phase="pull",r.ajax({type:"GET",url:this.opts.remote}).done(function(t){var e=t;r.isArray(t)||r.isPlainObject(t)?e=JSON.stringify(t):t=JSON.parse(t),i.storage.setItem(i.namespace,e),i._update(t),i.lastPull=Date.now()}).fail(function(){i.opts.error(arguments)}).always(function(){i.phase=null,2<=i.opts.debugLevel&&a.time&&a.timeEnd(i+".pull")})},push:function(){var t=this,e=this.commit();return this.phase&&l(this+": Trying to push while '"+this.phase+"' is pending."),2<=this.opts.debugLevel&&a.time&&a.time(t+".push"),this.phase="push",this.opts.remote||l(this+": Missing remote option"),r.ajax({type:"PUT",url:this.opts.remote,data:e}).done(function(){t.unpushedSince=null,t.pushCount+=1}).fail(function(){t.opts.error(arguments)}).always(function(){t.phase=null,2<=t.opts.debugLevel&&a.time&&a.timeEnd(t+".push")})},readFromForm:function(t,e){var o=this,a=r(t),h=r.extend({addNew:!1,coerce:!0,trim:!0},e);h.addNew&&a.find("[name]").each(function(){var t=r(this).attr("name");void 0===o._data[t]&&(o.debug("readFromForm: add field '"+t+"'"),o._data[t]=null)}),r.each(this._data,function(t,e){var i,s=a.find("[name='"+t+"']"),n=s.attr("type");s.length?("radio"===n?i=s.filter(":checked").val():"checkbox"===n&&1===s.length?i=!!s.filter(":checked").length:"checkbox"===n&&1<s.length?(i=[],s.filter(":checked").each(function(){i.push(r(this).val())})):(i=s.val(),h.trim&&"string"==typeof i&&(i=r.trim(i))),o.set(t,i)):o.debug("readFromForm: field not found: '"+t+"'")})},writeToForm:function(t,e){var n=r(t),o=this;r.each(this._data,function(t){var e=o.get(t),i=n.find("[name='"+t+"']"),s=i.attr("type");i.length&&("radio"===s?i.filter("[value='"+e+"']").prop("checked",!0):"checkbox"===s?1===i.length?i.prop("checked",!!e):i.each(function(){r(this).prop("checked",r.isArray(e)?0<=r.inArray(this.value,e):this.value===e)}):i.is("select")?i.find("option").each(function(){r(this).prop("selected",r.isArray(e)?0<=r.inArray(this.value,e):this.value===e)}):"file"===s||i.val(e))})}},window.PersistentObject}); | ||
//# sourceMappingURL=persisto.min.js.map |
@@ -0,0 +0,0 @@ Copyright 2016-2017 Martin Wendt, |
@@ -7,3 +7,3 @@ { | ||
"main": "dist/persisto.js", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/mar10/persisto", | ||
@@ -38,21 +38,23 @@ "author": { | ||
"devDependencies": { | ||
"eslint": "^5.12.0", | ||
"eslint-config-prettier": "^3.4.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"grunt": "^1.0.4", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-compress": "^1.0.0", | ||
"eslint": "^7.8.1", | ||
"eslint-config-jquery": "^3.0.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"grunt": "^1.1.0", | ||
"grunt-contrib-clean": "^2.0.0", | ||
"grunt-contrib-compress": "^1.5.0", | ||
"grunt-contrib-concat": "^1.0.0", | ||
"grunt-contrib-connect": "^1.0.0", | ||
"grunt-contrib-connect": "^2.0.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-jshint": "^1.0.0", | ||
"grunt-contrib-qunit": "^1.0.1", | ||
"grunt-contrib-uglify": "^1.0.0", | ||
"grunt-contrib-qunit": "^4.0.0", | ||
"grunt-contrib-uglify": "^4.0.0", | ||
"grunt-contrib-watch": "^1.1.0", | ||
"grunt-eslint": "^21.0.0", | ||
"grunt-saucelabs": "^9.0.1", | ||
"grunt-text-replace": "^0.4.0", | ||
"grunt-yabs": "^1.1.4", | ||
"prettier": "^1.15.3" | ||
"grunt-yabs": "^1.3.0", | ||
"prettier": "^1.16.4" | ||
}, | ||
"peerDependencies": { | ||
"jquery": ">=1.12" | ||
}, | ||
"scripts": { | ||
@@ -59,0 +61,0 @@ "test": "grunt ci --verbose" |
@@ -0,0 +0,0 @@ # persisto |
@@ -45,6 +45,6 @@ /*! | ||
/* jshint ignore:start */ if (!(this instanceof PersistentObject)) { | ||
// eslint-disable-next-line no-undef | ||
if (!(this instanceof PersistentObject)) { | ||
error("Must use 'new' keyword"); | ||
} | ||
/* jshint ignore:end */ | ||
@@ -108,4 +108,8 @@ if (typeof namespace !== "string") { | ||
self.offline = true; | ||
if (prevValue != null) { | ||
if (prevValue == null) { | ||
console.warn( | ||
self + ": could not init from remote; falling back default." | ||
); | ||
} else { | ||
console.warn( | ||
self + ": could not init from remote; falling back to storage." | ||
@@ -119,9 +123,6 @@ ); | ||
); | ||
} else { | ||
console.warn( | ||
self + ": could not init from remote; falling back default." | ||
); | ||
} | ||
dfd.resolve(); | ||
}); | ||
// eslint-disable-next-line no-negated-condition | ||
} else if (prevValue != null) { | ||
@@ -159,3 +160,5 @@ this.update(); | ||
if (!deferredCall) { | ||
if (deferredCall) { | ||
this.debug("_invalidate() recursive"); | ||
} else { | ||
// this.debug("_invalidate(" + hint + ")"); | ||
@@ -170,4 +173,2 @@ this.lastModified = now; | ||
this.opts.change(hint); | ||
} else { | ||
this.debug("_invalidate() recursive"); | ||
} | ||
@@ -353,4 +354,3 @@ | ||
setDirty: function(flag) { | ||
if (flag === false) { | ||
} else { | ||
if (flag !== false) { | ||
this._invalidate("explicit"); | ||
@@ -529,6 +529,8 @@ } | ||
writeToForm: function(form, options) { | ||
var $form = $(form); | ||
var $form = $(form), | ||
self = this; | ||
$.each(this._data, function(k, v) { | ||
var $input = $form.find("[name='" + k + "']"), | ||
$.each(this._data, function(k) { | ||
var v = self.get(k), | ||
$input = $form.find("[name='" + k + "']"), | ||
type = $input.attr("type"); | ||
@@ -561,2 +563,4 @@ | ||
}); | ||
} else if (type === "file") { | ||
// #3 skip type=file | ||
} else { | ||
@@ -563,0 +567,0 @@ $input.val(v); |
@@ -0,0 +0,0 @@ ;(function($, window, document, undefined) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175923
17
1803
1
24