After I came up with this idea, I did some research and found this, https://www.quora.com/Why-doesnt-the-Internet-switch-to-JSON-instead-of-HTML
The answers make much sense, except that I had a slightly different idea. With my proposal, modern browsers should be able to make the switch smoothly.
Say we have the following html,
<div class="basket col">
<div class="btn">Run Robot</div>
<p>Next Fruit is
<span>
some text here
</span>
</p>
</div>
We can convert it as follows, (Step 1)
<div class="basket col">
<div class="btn">Run Robot</>
<p>Next Fruit is
<span>
some text here
</>
</>
</>
Now we have saved the load which was wasted on closing tags.
It can be further simplified with a syntax as follows,
div class="basket col" <
div class="btn" < Run Robot >
p < Next Fruit is
span <
some text here
>
>
>
I have some understanding about how a parser would work, and I feel that this syntax is feasible to be parsed.
Modern browsers can start supporting both syntaxes. The developers can then decide which syntax to use. If they don't want to support legacy browsers, they can start using the new syntax.
Can this be done? If not, why?
Aucun commentaire:
Enregistrer un commentaire