Is it possible to have a non-linked listview widget a data-icon?
You will have to add it to each list item yourself. You can format items any way you want. It just takes whatever HTML and CSS that you add within the item.
Otherwise, no, you can't add an icon simply by using data-icon on the
<ul> tag. That is meant as a "disclosure icon". It's placed in a standard location at the right where users expect to see an arrow if tapping on the row will navigate to another page.
If you use an icon for some other purpose, how could jQuery Mobile read your mind and know the appropriate place to put the icon?
It's just a convenience for a standard use case.
Therefore I wondered what does jQuery do differently in terms of
rendering for <li><a></a></li> items compared to
<li></li> items?
- In the latter case, JQM creates bloated HTML.
- In the former case, JQM creates
tremendously bloated HTML. It also manages highlighting of selected items in a tremendously inefficient way.
If performance matters, don't use a listview. For most uses, listviews solve a trivial problem (how to format a list item nicely) with an overly-complex solution and unacceptable performance cost. And if you don't exactly like the way JQM formats the items, it is a lot of trouble to change it.
Just create a plain list (no
data-role="listview") and write a bit of CSS.