MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / removeInternalForSave

Method removeInternalForSave

src/utils.ts:520–531  ·  view source on GitHub ↗

removes internal fields '_' and default values for saving

(n: GridStackNode, removeEl = true)

Source from the content-addressed store, hash-verified

518
519 /** removes internal fields '_' and default values for saving */
520 static removeInternalForSave(n: GridStackNode, removeEl = true): void {
521 for (let key in n) { if (key[0] === '_' || n[key] === null || n[key] === undefined ) delete n[key]; }
522 delete n.grid;
523 if (removeEl) delete n.el;
524 // delete default values (will be re-created on read)
525 if (!n.autoPosition) delete n.autoPosition;
526 if (!n.noResize) delete n.noResize;
527 if (!n.noMove) delete n.noMove;
528 if (!n.locked) delete n.locked;
529 if (n.w === 1 || n.w === n.minW) delete n.w;
530 if (n.h === 1 || n.h === n.minH) delete n.h;
531 }
532
533 /** return the closest parent (or itself) matching the given class */
534 // static closestUpByClass(el: HTMLElement, name: string): HTMLElement {

Callers 3

saveMethod · 0.80
makeSubGridMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected