In an attempt to make a hiearchical menu structured from JSON data with an unknown depth, I tried creating a partial that referenced itself. I hadn’t seen it documented so I wasn’t expecting anything to happen. To my surprise, it worked.
Here’s an example of what I did: http://jsbin.com/olEDivI/3/edit
The only problem is, I noticed that performance tanks in some browsers. For example, in Safari, the first time going to this example seems to take a while to display. On some occassions it doesn’t do anything. In certain older versions of Chrome, it would take over a minute to display the list.
I really like being able to use partials this way. My concern is that performance issues won’t allow me to use this in production.