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

Repetition Model for HTML DOM


This Javascript library implements the Repetition Model originally planned for inclusion in the official Web Forms 2.0 specification.


The Repetition Model was abandoned as an official standard for declarative HTML, however, you can implement or emulate this standard using this Javascript library, as anticipated by WhatWG/ W3C.

Javascript source code

Please view the source code here.

Licence—freeware (GPL2)

See the licence declaration at the head of the source code for more details. Since the original version was GPL2-licensed, all subsequent versions (including our updated versions of this code) must be distributed under a similar GPL2 licence: we are fulfilling our legal & moral obligations to the original developer and the broader software community, by supplying this software freely to you under these terms. We have chosen not to charge a redistribution fee for this product at this time.

Instructive examples

When first working with the Repetition Model from the Web Forms 2.0 prototype specification, I found these examples & tests most instructive. The partial adoption of the original Web Forms 2.0 specification into HTML5 broke the original Javascript implementation, which interpreted indications of Web Forms 2.0 support to imply implementation of the abandoned Repetition Model. To make these examples work, I have transferred them to this site by kind permission of the author (Mr. Weston Ruter), to demonstrate them working with my updated Javascript code.

  1. Specification: Sample Order Form
  2. Specification: Repeated rows
  3. Specification: Nested repetition (Solar system)
  4. Movement Buttons and Cancelling Default Action
  5. Repetition Index in Attributes
  6. Repetition Events
  7. Repetition Event Handler Attributes
  8. Initialization Time
  9. Repetition Buttons
  10. Orphan Repetition Blocks
  11. Disabled Form Fields in Template
  1. repeat-min, repeat-max, & repeat-start attributes
  2. Repeated Photo Albums
  3. Exceptions in Repetition Events
  4. Required Elements in Repeated Blocks
  5. Autofocus on unfocusable form control
  6. Form validation
  7. Input Controls in Nested Repetition Blocks
  8. Prefilling form data
  9. Creating Repetition Templates Dynamically
  10. "required" attribute on checkboxes & radio buttons

How we are using the Repetition Model:

Authors and contributors

  1. Original specification proposal written by Ian Hickson (around 2005–2006)
  2. Developed by the WhatWG (2006–2008) as part of the original Web Forms 2.0 specification
  3. Javascript implementation written by Weston Ruter (2007)
  4. Refactored, debugged, updated and improved by Zoltan Hawryluk (2010)
  5. Debugged by Hallvord R.M. Steen at Opera Development (about 2011–2012)
  6. Updated (during 2011‒2015) by for compatibility with the final Web Forms 2.0 specification. Also removed vestigial implementations in Javascript of parts of Web Forms 2.0 which have since been incorporated into the final official HTML5 specification.