04 January, 2006

HTML, DOM and Ajax Features

Thinking about the HTML tree and the DOM capabilities, I come to the conclusion that you can very easily apply an Ajax feature to several HTML element at the same time. What you need is to have a common parent for them and apply the feature to the parent. If the parent moves, fades, resizes, disappear, change font style, etc... the children elements will act the same.
What if you want to fade a thumbnail of a picture once the picture is faded ? God, you have to write specific code to indicate to fade the thumbnails each time a related picture is faded!
To me, it's a big lack in HTML that you cannot group elements otherwise than in a tree style. Worse, doing so, HTML tags are used both ways : for graphic rendering and for encapsulation. Think about two HTML DIV you want to move together. You will create a tird DIV that contains them. First two DIV : graphical ; Tird DIV : encapsulation.

<div id="I'm here for non graphical reason">
<div>First DIV</div>
<div>Second DIV</div>
</div>

In our framework, we introduce a non graphical element that contains graphical elements and responds to Ajax features as a graphical element would. This way, it is transparent for the developper to apply a feature to a graphical or a non graphical element. And there is NO DOM element which are used for feature managment.

firstDiv = new LDivElement('first', 'First DIV');
secondDiv = new LDivElement('second', 'Second DIV');
group = new LDomListElement(firstDiv, secondDiv);

See the difference between the two classes LDivElement and LDomListElement while in HTML it's always HTMLDivElement.

No comments: