Log in
Assorted digital displays showing
numbers in different colours,
format and pixellation
2011-03-07 13:35

Example 5: Repetition Index in Attributes

For all attributes in a block, template name is to be replaced with the block's current repetition index. The first section below is a test case taken from: https://simon.html5.org/test/webforms2/repetition/addition/001.htm; the second section contains a more thorough test case. When used with Weston Ruter's original implementation and contemporary Opera versions, it exhibits that implementation's issue #7 and Opera bug #230280.

The specification defines the correct behavior in 3.6.1. Addition:
…any occurrences of a string consisting of an opening square bracket (U+005B, "[") or a modifier letter half triangular colon (U+02D1, "ˑ"), the template's name, and a closing square bracket (U+005D, "]") or a middle dot (U+00B7, "·"), are replaced by the new repetition block's index. This is performed regardless of the types, names, or namespaces of attributes, and is done to all descendants, even those inside nested forms, nested repetition templates, and so forth.

Test Case from simon.html5.org


The above should be exactly equivalent to the following:


Extensive Attribute Test

Whereas every attribute which contains "[j]" should be replaced with the repetition index (0), it is likely, due to Opera bug #230280 and issue #7, the specified behavior will fail in style and non-CDATA attributes (note that a '1' is also included as "1[j]" so the value of "10" should appear in each attribute):

(This field has access key set to 1[j])

Image 1[j] test
rowspan colspan

Test results

Attribute Value of attribute (should contain '10')

Test result: working...

  1. working...

↑ Menu
Previous edition ↓