Good question. When I started using the framework I was wondering the same 
thing.

Most JS frameworks use HTML templates mostly because the HTML is the markup 
used for the structure of the app.

Since we’re writing MXML, there’s no real reason to output HTML.

The way other frameworks deal with modifying the HTML is by complicated tree 
lookups to match up the JS state with the HTML structure. Whether or not the 
HTML comes from html files or MXML files, for us to support arbitrary HTML, we 
would need a similar system. While possible, I’m not sure it’s a direction I’d 
go.

There’s quite a few performance advantages to constructing the DOM tree via 
Javascript:

1. No need for the browser to load additional files.
2. No need for the browser to parse HTML markup.
3. JS lookup trees are very expensive. This is the biggest performance hit of 
using other frameworks. We avoid this by keeping direct references in the 
Royale components.
4. We don’t need to “find” elements because we already have direct references 
since the framework created them. We’re probably more performant than even 
“vanilla javascript” because we generally don’t need to even ask the browser to 
look up elements for us.

Harbs

> On Nov 21, 2017, at 11:32 PM, Olaf Krueger <[email protected]> wrote:
> 
> Hi,
> I noticed that the compiler builds JS from MXML and the JS finally creates
> the HTML elements dynamically at runtime.
> I just wonder what is the benefit of this and if it would also possible to
> introduce a component set that builds HTML from MXML directly.
> 
> 
> Thanks,
> Olaf
> 
> 
> 
> --
> Sent from: http://apache-royale-development.20373.n8.nabble.com/

Reply via email to