Ask a questionAsk a question
 

QuestionChanging a span's attribute duplicates the whole span

  • Wednesday, September 23, 2009 5:58 PMPhilipp.Sumi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Imagine the user selects some formatted text in edit mode and invokes my plug-in. The selected text corresponds to the following markup:

    <span class="foo">hello</span>

    Accordingly, this is the markup my plug-in receives as the content string. Now, all my plug-in does is change the class attribute's value. Accordingly, this is the new value of the content string:

    <span class="bar">hello</span>


    However, it appears that WLW tries to be smart - in a really dumb way ;)
    When I switch to HTML view, I can see I ended up with the following markup:

    <span class="foo"><span class="bar">world </span></span>


    ...I really don't see any reason for this. Any idea of a workaround would be greatly appreciated.

    Cheers,
    Philipp
    Confessions of a Code Addict: http://www.hardcodet.net