Skip to content

Improving update granularity #13

@thipages

Description

@thipages

Hi,
Currently and if I understand well, updates thanks to DOM method of Dominus

  1. happen at the territory level (ie as a child of an existing Dom element, ultimately at the body level : DOM.add ("element", "body"); )
  2. Only those elements are considered for update and the update is a full HTML replacement through innerHTML Dom property.
  3. Also the underscore convention (eg element_input) allows to get the right root element (element) and update from that root if exists.

I have thought about another (complementary) way of updating DOM with more granularity but this requires additional concept. The idea is to use the HTML key (HTML[html_key]) as the id of the tag. This could be

  • either chosen as an attribute (not ideal)
  • or calculated as a UID (better)
  • or both

The usage could be like this (if calculated)

var DOM = new Dominus();
// UID is generated behind the scene creating HTML[generatedUID] corresponding to myElement
var myElement = DOM.element ({tag:'div',class:'myClass'}); 
DOM.class.add(myElement.id, 'myClass2'); // or simplier DOM.class.add(myElement, 'myClass2');

In the proxy process, update could then be managed by the function replaceChild
replacedNode = parentNode.replaceChild(newChild, oldChild); with parentNode=oldChild

What do you think? (hope I was clear)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions