Permalink
Browse files

gallery-2014.02.26-18-54 ItsAsbreuk gallery-itsaformmodel

  • Loading branch information...
1 parent 2c28b9f commit 88b43d619363e44835dca542d99d3ab18fd86100 @ekashida ekashida committed Feb 26, 2014
Showing with 334 additions and 79 deletions.
  1. +2 −2 build/gallery-itsaformmodel/gallery-itsaformmodel-coverage.js
  2. +94 −9 build/gallery-itsaformmodel/gallery-itsaformmodel-debug.js
  3. +4 −4 build/gallery-itsaformmodel/gallery-itsaformmodel-min.js
  4. +93 −8 build/gallery-itsaformmodel/gallery-itsaformmodel.js
  5. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel.js
  6. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_ar.js
  7. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_bg.js
  8. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_bs.js
  9. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_cs.js
  10. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_da.js
  11. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_de.js
  12. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_en.js
  13. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_es.js
  14. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_fa.js
  15. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_fi.js
  16. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_fr.js
  17. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_he.js
  18. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_hi.js
  19. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_hr.js
  20. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_hu.js
  21. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_it.js
  22. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_ja.js
  23. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_nb.js
  24. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_nl.js
  25. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_pl.js
  26. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_pt.js
  27. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_ru.js
  28. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_sk.js
  29. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_sr.js
  30. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_sv.js
  31. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_uk.js
  32. +1 −1 build/gallery-itsaformmodel/lang/gallery-itsaformmodel_zh.js
  33. +1 −1 src/gallery-itsaformmodel/docs/index.mustache
  34. +93 −8 src/gallery-itsaformmodel/js/gallery-itsaformmodel.js
  35. +2 −2 src/gallery-itsaformmodel/logs/tests.json
  36. +17 −17 src/gallery-itsaformmodel/logs/yogi.stdout.log
Oops, something went wrong.
@@ -405,7 +405,7 @@ ITSAFormModel.prototype.initializer = function() {
instance._ATTRS_nodes = {},
/**
- * internal backup of which nodeid's have been inserted in the dom before, referenced by nodei's
+ * internal backup of which nodeid's have been inserted in the dom before, referenced by nodeid's
* object-properties are 'true' when not found the be removed from the dom yet and a timestamps when
* out of the dom (stamped with the time out-of-dom was registered)
* @property _knownNodeIds
@@ -640,15 +640,15 @@ ITSAFormModel.prototype.disableUI = function() {
* Only to be used when destroyed - or when a containernode gets empty.
*
* @method cleanup
+ * @param [container] {Y.Node} only cleanup items inside this container
* @protected
* @since 0.1
*/
-ITSAFormModel.prototype.cleanup = function() {
- // TODO: also destroy the widgets in case their nodeid's are in the dom
+ITSAFormModel.prototype.cleanup = function(container) {
var instance = this;
- instance._FORM_elements = {};
- instance._ATTRS_nodes = {};
- instance._knownNodeIds = {};
+/*jshint expr:true */
+ container ? instance._cleanupContainer(container) : instance._cleanup();
+/*jshint expr:false */
};
/**
@@ -1703,7 +1703,7 @@ ITSAFormModel.prototype.translatePromise = ITSAFormModel.translatePromise;
* @since 0.1
*/
ITSAFormModel.prototype.validated = function() {
- Y.log('destructor', 'info', 'ITSAFormModel');
+ Y.log('validated', 'info', 'ITSAFormModel');
return (this.getUnvalidatedUI().size()===0);
};
@@ -1958,6 +1958,87 @@ ITSAFormModel.prototype._bindUI = function() {
};
/**
+ * Cleans up internal references of everything the formmodel has inserted in the dom.
+ * Only to be used when destroyed - or when a containernode gets empty.
+ *
+ * @method _cleanup
+ * @protected
+ * @private
+ * @since 0.1
+*/
+ITSAFormModel.prototype._cleanup = function() {
+ var instance = this,
+ formelements = instance.getCurrentFormElements(),
+ node;
+ YArray.each(
+ formelements,
+ function(formelement) {
+/*jshint expr:true */
+ formelement.widget && formelement.widget.destroy(true);
+/*jshint expr:false */
+ node = Y.one('#'+formelement.nodeid);
+ if (node) {
+ node.get('childNodes').destroy(true);
+ node.remove(true);
+ }
+ }
+ );
+ instance._FORM_elements = {};
+ instance._ATTRS_nodes = {};
+ instance._knownNodeIds = {};
+};
+
+/**
+ * Cleans up internal references of everything the formmodel has inserted inside the container.
+ * Only to be used when a containernode gets empty.
+ *
+ * @method _cleanupContainer
+ * @param [container] {Y.Node} only cleanup items inside this container
+ * @protected
+ * @private
+ * @since 0.1
+*/
+ITSAFormModel.prototype._cleanupContainer = function(container) {
+ var instance = this,
+ attributenodes = instance._ATTRS_nodes,
+ formelements = instance._FORM_elements,
+ knownNodeIds = instance._knownNodeIds,
+ knowdIdsRemoval = [],
+ node, formelement, attribute, indexofitem;
+ YObject.each(
+ knownNodeIds,
+ function(value, nodeid) {
+ formelement = formelements[nodeid];
+ node = container.one('#'+nodeid);
+ // remove node
+ if (node) {
+/*jshint expr:true */
+ formelement.widget && formelement.widget.destroy(true);
+/*jshint expr:false */
+ node.get('childNodes').destroy(true);
+ node.remove(true);
+ delete formelements[nodeid];
+ // now find the inside the array _ATTRS_nodes[attribute] for the item that holds ref. to the nodeid
+ attribute = formelement.name;
+ indexofitem = attributenodes[attribute].indexOf(nodeid);
+/*jshint expr:true */
+ indexofitem && attributenodes[attribute].splice(indexofitem, 1);
+/*jshint expr:false */
+ // now store the nodeid, because it has to be removed from instance._knownNodeIds
+ knowdIdsRemoval.push(nodeid);
+ }
+ }
+ );
+ // now remove it from knownNodeIds
+ YArray.each(
+ knowdIdsRemoval,
+ function(nodeid) {
+ delete knownNodeIds[nodeid];
+ }
+ );
+};
+
+/**
* Cleaning up all eventlisteners
*
* @method _clearEventhandlers
@@ -2034,7 +2115,11 @@ ITSAFormModel.prototype._defFn_changedate = function(e) {
// be carefull: button might not exist anymore, when the view is rerendered
if (node) {
node.removeAttribute(DATA_CONTENT);
- node.focus();
+ try {
+ // ALWAYS focus nodes using try/catch to prevent js-error when node not in the dom
+ node.focus();
+ }
+ catch(err) {}
tipsycontent = node.getAttribute(DATA+'-contentvalid');
/*jshint expr:true */
tipsycontent && node.setAttribute(DATA_CONTENT, tipsycontent);
@@ -2720,7 +2805,7 @@ YArray.each(
}
);
-}, 'gallery-2014.01.10-22-44', {
+}, 'gallery-2014.02.26-18-54', {
"requires": [
"yui-base",
"event-valuechange",
Oops, something went wrong.
@@ -404,7 +404,7 @@ ITSAFormModel.prototype.initializer = function() {
instance._ATTRS_nodes = {},
/**
- * internal backup of which nodeid's have been inserted in the dom before, referenced by nodei's
+ * internal backup of which nodeid's have been inserted in the dom before, referenced by nodeid's
* object-properties are 'true' when not found the be removed from the dom yet and a timestamps when
* out of the dom (stamped with the time out-of-dom was registered)
* @property _knownNodeIds
@@ -637,15 +637,15 @@ ITSAFormModel.prototype.disableUI = function() {
* Only to be used when destroyed - or when a containernode gets empty.
*
* @method cleanup
+ * @param [container] {Y.Node} only cleanup items inside this container
* @protected
* @since 0.1
*/
-ITSAFormModel.prototype.cleanup = function() {
- // TODO: also destroy the widgets in case their nodeid's are in the dom
+ITSAFormModel.prototype.cleanup = function(container) {
var instance = this;
- instance._FORM_elements = {};
- instance._ATTRS_nodes = {};
- instance._knownNodeIds = {};
+/*jshint expr:true */
+ container ? instance._cleanupContainer(container) : instance._cleanup();
+/*jshint expr:false */
};
/**
@@ -1916,6 +1916,87 @@ ITSAFormModel.prototype._bindUI = function() {
};
/**
+ * Cleans up internal references of everything the formmodel has inserted in the dom.
+ * Only to be used when destroyed - or when a containernode gets empty.
+ *
+ * @method _cleanup
+ * @protected
+ * @private
+ * @since 0.1
+*/
+ITSAFormModel.prototype._cleanup = function() {
+ var instance = this,
+ formelements = instance.getCurrentFormElements(),
+ node;
+ YArray.each(
+ formelements,
+ function(formelement) {
+/*jshint expr:true */
+ formelement.widget && formelement.widget.destroy(true);
+/*jshint expr:false */
+ node = Y.one('#'+formelement.nodeid);
+ if (node) {
+ node.get('childNodes').destroy(true);
+ node.remove(true);
+ }
+ }
+ );
+ instance._FORM_elements = {};
+ instance._ATTRS_nodes = {};
+ instance._knownNodeIds = {};
+};
+
+/**
+ * Cleans up internal references of everything the formmodel has inserted inside the container.
+ * Only to be used when a containernode gets empty.
+ *
+ * @method _cleanupContainer
+ * @param [container] {Y.Node} only cleanup items inside this container
+ * @protected
+ * @private
+ * @since 0.1
+*/
+ITSAFormModel.prototype._cleanupContainer = function(container) {
+ var instance = this,
+ attributenodes = instance._ATTRS_nodes,
+ formelements = instance._FORM_elements,
+ knownNodeIds = instance._knownNodeIds,
+ knowdIdsRemoval = [],
+ node, formelement, attribute, indexofitem;
+ YObject.each(
+ knownNodeIds,
+ function(value, nodeid) {
+ formelement = formelements[nodeid];
+ node = container.one('#'+nodeid);
+ // remove node
+ if (node) {
+/*jshint expr:true */
+ formelement.widget && formelement.widget.destroy(true);
+/*jshint expr:false */
+ node.get('childNodes').destroy(true);
+ node.remove(true);
+ delete formelements[nodeid];
+ // now find the inside the array _ATTRS_nodes[attribute] for the item that holds ref. to the nodeid
+ attribute = formelement.name;
+ indexofitem = attributenodes[attribute].indexOf(nodeid);
+/*jshint expr:true */
+ indexofitem && attributenodes[attribute].splice(indexofitem, 1);
+/*jshint expr:false */
+ // now store the nodeid, because it has to be removed from instance._knownNodeIds
+ knowdIdsRemoval.push(nodeid);
+ }
+ }
+ );
+ // now remove it from knownNodeIds
+ YArray.each(
+ knowdIdsRemoval,
+ function(nodeid) {
+ delete knownNodeIds[nodeid];
+ }
+ );
+};
+
+/**
* Cleaning up all eventlisteners
*
* @method _clearEventhandlers
@@ -1990,7 +2071,11 @@ ITSAFormModel.prototype._defFn_changedate = function(e) {
// be carefull: button might not exist anymore, when the view is rerendered
if (node) {
node.removeAttribute(DATA_CONTENT);
- node.focus();
+ try {
+ // ALWAYS focus nodes using try/catch to prevent js-error when node not in the dom
+ node.focus();
+ }
+ catch(err) {}
tipsycontent = node.getAttribute(DATA+'-contentvalid');
/*jshint expr:true */
tipsycontent && node.setAttribute(DATA_CONTENT, tipsycontent);
@@ -2658,7 +2743,7 @@ YArray.each(
}
);
-}, 'gallery-2014.01.10-22-44', {
+}, 'gallery-2014.02.26-18-54', {
"requires": [
"yui-base",
"event-valuechange",
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 88b43d6

Please sign in to comment.