Hi!
I’m pretty sure I’m not the first doing something like this.
Yesterday I created a snippet called a.php containing an <a>
tag, a letter ‘a’ and a call for the ‘a’ snippet.
// site/snippets/a.php
<a>
a <?php snippet('a') ?>
</a>
Then I wanted to spice it up a little, so I created another snippet called b.php and I let A call B and B call A.
// site/snippets/a.php
<a>
a <?php snippet('b') ?>
</a>
// site/snippets/b.php
<b>
b <?php snippet('a') ?>
</b>
Results
In the first case (A only) the result would be a very long list of <a> a </a>
.
In the second case (A and B) the structure gets more interesting, something like this:
<a>
<b></b>
</a>
<b>
<a>
<b></b>
</a>
<b>
<a>
<b></b>
</a>
<b>
...
</b>
</b>
</b>
Conclusions:
First of all, I honestly expected my browser to crash, and it didn’t.
Second thing, I can’t explain why the number of DOM elements generated this way is always different, and the difference could is quite huge (from 5000 to more than 25000).
Has anyone ever done similar experiments and does anybody have an answer to the different number of elements generated?