What’s wrong with VS HTML editor parser?

Parsing HTML for editing purposes is quite different from parsing it by the book. VS HTML parser has a quite a few deviations that allow us to better support statement completion and validation. Look at this bug which we usually see every release since VS 2002 (that's when the code was added). Consider the following markup:

<a b="c" d="e">

User positions caret right after "c", hits backspace twice and invokes statement compeltion for attribute b by hitting Ctrl+Space. The markup looks now like

<a b=" d="e">

If we parse by the book and consider " d=" to be a value for b, statement competion will then replace " d=" by the new value, significantly damaging user code. Since this is much more common editing scenario that having sequence


at the end of the attribute value, we give it higher priority.

The issue ofny manifests itself when attribute value ends with an equal sign or with an equal sign followed by a whitespace. <a b="c=d"> actually works fine. The workaround is either to avoid trailing = (try to use : instead) or encode = as an entity: &#61;

We are looking into building a better parser in the future, of course.

Comments (1)

  1. Namrata says:

    Invivo software has developed a component called "WebDesigner" that wraps the MSHTML editing platform. It has some cool features including –

    1. Code preservation.

    2. Rendering custom tags.

    3. Rendering include pages for jsp documents

    For more information visit – http://www.invivosoft.com

    Note: I work for Invivo software.



Skip to main content