Gurigraphics / DOMinus.js

DOMinus.js is a reactive data binding library that turn HTML irrelevant.
4 stars 1 forks source link

mount MOD method #3

Closed thipages closed 5 years ago

thipages commented 5 years ago

Hi, I dont understand the two following conditions in the code :

  1. https://github.com/Gurigraphics/DOMinus.js/blob/master/src/dominus.js#L95
  2. https://github.com/Gurigraphics/DOMinus.js/blob/master/src/dominus.js#L101

it seems to me that data.mount and data.mountMap are never set.

Where am I wrong? Thank you.

Gurigraphics commented 5 years ago

This is a little confusing. There are several recursive calls to "MOD.mount( x )" If there are multiple childs inside childs it probably goes around.

thipages commented 5 years ago

The recursive MOD.mount(x) seem ok. The question is more about data.mount and data.mountMap It seems to me that they are not used.

thipages commented 5 years ago

Another way to describe my question is looking at this array in the verify method var array = [ "html", "mount", "mountMap", "mounts", "tag" ]

My question is when does the verify method catches "mount" or "mountMap" or "mounts"

Gurigraphics commented 5 years ago

I have not more checked what is used or not. In the next refactoring I can see this. Thanks for the note.

Before there were several ways to do the same thing. Like:

var h = DOM.mounts 
var x = h(x,y, h(x,y h(x,y  )  )  ) 
$("id").append(x)

I then simplified it to DOM.add

If (data.mount) is not used, it must be because I started using mountMap to object that has childs.

This array is used to remove these attributes from the HTML markup.

var array = [ "html", "mount", "mountMap", "mounts", "tag" ]

The exact representation of the object would look like this in the DOM:

<div id="element" tag="div" html="other_content" mountMap="other_content"></div>

Then are removed. Because only matters:

<div id="element"></div>

Note also that I do not use methods:

document.createElement("BUTTON");  
document.createTextNode("CLICK ME"); 

I create HTML from scratch using strings "<+tag+>name</+tag+>"

thipages commented 5 years ago

Anyway I like the way you manage so simply html via js and I am currently testing it in different configurations. There will be a time for code speed optimization. Creating tags from scratch may be the fatest way, I dont know ....

Gurigraphics commented 5 years ago

This part of performance testing I do not understand much. But it is possible to compare similar projects created with vue, react, angular, etc.

The initial notation was inspired by Mithril. However, my main focus is the "organization of complex projects". Using other frameworks everything was very mixed and tiring to deal with. When this did not uses ram of the computer, it consumed mental ram memory. :)

Gurigraphics commented 5 years ago

Removed duplicated code in MOD.mount https://github.com/Gurigraphics/DOMinus.js/issues/10