Linebreaks break listview links

4 posts, 0 answers
  1. Oscar
    Oscar avatar
    2 posts
    Member since:
    Oct 2011

    Posted 06 Apr 2012 Link to this post

    After spending a decent amount of time trying to figure out why my listview didn't work, I discovered that the following code doesn't work:

        <ul data-role="listview" data-style="inset">
            <li data-icon="toprated">
                <a>Nairobi</a>
            </li>
        </ul>

    However this work:

        <ul data-role="listview" data-style="inset">
            <li data-icon="toprated"><a>Nairobi</a></li>
        </ul>

     It seems that adding a space between the <li> and the <a> makes it break, causing no icons or links to work correctly (doesn't load the view but treats it as an external link). This is in build 2012.1.406.

    Just wanted to point it out for anybody else who might struggle with this. :-)


  2. Petyo
    Admin
    Petyo avatar
    2438 posts

    Posted 09 Apr 2012 Link to this post

    Hi,

    I can confirm that. Automatic link styling is triggered on when the link is the only child of the li element. Whitespace is also DOM elements. 

    Although the whitespace elements can be iterated and ignored, this would be quite performance intensive, especially for a mobile device. 

    Regards,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Oscar
    Oscar avatar
    2 posts
    Member since:
    Oct 2011

    Posted 09 Apr 2012 Link to this post

    I understand, and it might not be a huge issue for many, however it might be a good idea to mention this in the documentation or the examples, since many people have editors which do some sort of tidying on the HTML or similar, which might not understand why it don't work.

    The linebreak notation:

    <li>
      <a>asa</a>
    </li>

    is quite a common form for keeping HTML readable and structured and is what most people are taught through tutorials etc. :-)
  5. Petyo
    Admin
    Petyo avatar
    2438 posts

    Posted 10 Apr 2012 Link to this post

    Thanks for the feedback - indeed this is an inconvenience worth mentioning. 

    Kind regards,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready