Generated markupSwitch/caseNon-table contentWith the following:
<xforms:switch> <xforms:case id="case-a">A</xforms:case> <xforms:case id="case-b">B</xforms:case> </xforms:switch>
The following HTML is sent to the browser:
<span class="xforms-switch" id="xforms-element-5"> <span class="xforms-case-begin-end" id="xforms-case-begin-case-a"/> <span class="xforms-case-selected">A</span> <span class="xforms-case-begin-end" id="xforms-case-end-case-a"/> <span class="xforms-case-begin-end" id="xforms-case-begin-case-b"/> <span class="xforms-case-deselected">B</span> <span class="xforms-case-begin-end" id="xforms-case-end-case-b"/> </span>
Table contentWhen a content of an <xforms:case> is a table row or table cell, as in:
<xhtml:tr> <xforms:switch> <xforms:case id="case-a"> <xhtml:th>A</xhtml:th> </xforms:case> <xforms:case id="case-b"> <xhtml:th>B</xhtml:th> </xforms:case> </xforms:switch> </xhtml:tr>
The following HTML is sent to the browser:
<tr> <th class="xforms-case-begin-end" id="xforms-case-begin-case-a"/> <th class="xforms-case-selected">A</th> <th class="xforms-case-begin-end" id="xforms-case-end-case-a"/> <th class="xforms-case-begin-end" id="xforms-case-begin-case-b"/> <th class="xforms-case-deselected">B</th> <th class="xforms-case-begin-end" id="xforms-case-end-case-b"/> </tr>
RelevanceNon-table content
With the following XForms: <xforms:group ref=".[. = 'true']"> <xhtml:p>Text</xhtml:p> </xforms:group>
The following HTML content is sent to the browser: <span class="xforms-group xforms-disabled" id="xf-10"> <p>Text</p> </span>
CSSVisibility of casesFor xforms-case-selected and xforms-case-deselected, we hide/show cases with visibility and position instead of display as recommended by by YUI. Not doing so causes issues to some widgets (including the slider and the datatable) when shown in a section of the page which is hidden when the widget is initialized.
.xforms-case-selected { visibility: visible; position: static; }
.xforms-case-deselected, .xforms-case-deselected .xforms-case-selected { top: -10000px; left: -10000px; visibility: hidden; position: absolute; }
We later hide a case, we use:
.xforms-case-begin-end { display: none; }
The hiding content section of the "IE bugs" page has more details about this CSS. Unit tests
We have two visual unit tests for this. (They are called "visual" because they can't be executed automatically; someone needs to run the test and check that what is on the screen conforms to what is expected.) |