Browserscope

What are the Rich Text Tests?

These tests cover browers' implementations of contenteditable for basic rich text formatting commands. Most browser implementations do very well at editing the HTML which is generated by their own execCommands. But a big problem happens when developers try to make cross-browser web applications using contenteditable - most browsers are not able to correctly change formatting generated by other browsers. On top of that, most browsers allow users to to paste arbitrary HTML from other webpages into a contenteditable region, which is even harder for browsers to properly format. These tests check how well the execCommand, queryCommandState, and queryCommandValue functions work with different types of HTML. Please note that these are WYSIWYG editing tests, not semantic editing tests. Any HTML which produces a given visual style should be changeable via the execCommand for that style.

More About Each Test

Apply Formatting

These tests use execCommand to apply formatting to plain text. They simply run the execCommand and check if any HTML is generated around the selected text. They do not make a judgement call as to what the correct HTML should be, only that the given visual style is applied. So <b>, <STRONG>, and <span style="font-weight:bold"> are all considered valid output of the bold execCommand. The reason for this is that these tests are for WYSIWYG editing, not semantic editing. There are many execCommands which are not tested here; only the most commonly used commands for rich text editing are included. The output of the execCommand is shown in the last column of the test output.

Unapply Formatting

These tests put different combinations of HTML into a contenteditable iframe, and then run an execCommand to attempt to remove the formatting the HTML applies. For example, there are tests to check if bold styling from <b>, <strong>, and <span style="font-weight:normal"> are all removed by the bold execCommand. It is important that browsers can remove all variations of a style, not just the variation the browser applies on its own, because it's quite possible that a web application could allow editing with multiple browsers, or that users could paste content into the contenteditable region. These tests currently only run with styleWithCSS set to false. Any HTML which remains after the execCommand runs is shown in the last column of the test output.

Change Existing Formatting

These tests are similar to the unapply tests, except that they're for execCommands which take an argument (fontname, fontsize, etc.). They apply the execCommand to text which already has some formatting, in order to change it. After the execCommand runs, the tests find the text node which was selected, and climb up its ancestor chain to check that the given formatting is only applied once, and that it's the new format and not the old one. The last column of the test output shows the resulting HTML after applying the execCommand.

Query Formatting State and Value

These tests run queryCommandState (for execCommands with no argument) and queryCommandValue (for execCommands with an argument) on HTML with various types of formatting.

Home | FAQ | News | Code | Submit a Bug | Mailing List | Contact