Commit ed1c34e4 authored by Mathieu Giraud's avatar Mathieu Giraud

js/indexedDom.js: some comments

meeting with @duez
parent 9e9013db
Pipeline #112186 passed with stages
in 6 minutes and 55 seconds
......@@ -21,7 +21,7 @@
* along with "Vidjil". If not, see <>
/* an object that keep track of a specified dom element and his childs
/* an object that keep track of a specified dom element and his children
* provide a set of function to update contents/colors/display with minimal dom access
* the childs of the indexed element can be accessed by their className, the parent by using "main" as className
......@@ -42,13 +42,21 @@ IndexedDom.prototype = {
* save his DOM position for later use if not already done
getElement: function(className){
// The first time, stores the DOM element
if (typeof (this.div[className]) == "undefined")
this.div[className] = { element : this.div.main.element.getElementsByClassName(className)[0]};
// Returns the stored DOM element
return this.div[className].element;
/* Setters
The setters both stores the updated value in the IndexedDom as well as in the DOM.
Changes are done only when needed, because updating the DOM is slow... and these
setters are often called during an .update() without any actual changes.
content: function(className, newContent){
var div = this.getElement(className);
......@@ -99,6 +107,7 @@ IndexedDom.prototype = {
/* Clear */
clear: function(className){
var div = this.getElement(className);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment