[whatwg] Web Forms 2.0 Editorial [minor] Section 3

fantasai fantasai.lists at inkedblade.net
Sun Jun 13 15:10:05 PDT 2004


3. Repeating form controls
--------------------------

# Occasionally forms contain repeating sections, for example an order form
# could have one row per item, with product, quantity, and subtotal fields.

   Occasionally forms contain repeating sections>. F<or example an order form
   could have one row per item, >each< with >a< product, quantity, and subtotal
   field<>.


3.1 Introduction for authors
----------------------------

# Occasionally, a form may have a section to be repeated an arbitrary number
# of times.

   Occasionally, a form may >need< a section to be repeated an arbitrary number
   of times.

# all the attributes containing the template's id between square bracket
# characters ([id]) have that ID replaced by a unique index.

   all the attributes containing the template's id between square bracket
   characters ([id]) have that ID >(and the brackets)< replaced by a unique
   index.


# This can be solved by adding an add  button. The add button type adds a copy
# of a template when the user presses the button, in much the same way as the
# repeat element does.


   This can be solved by adding an add  button. The add button type adds a copy
   of a template when the user presses the button, in much the same way <> the
   repeat element does.

# The template attribute contains an ID that should match the ID of the template
# you want the button to affect.

   The template attribute contains <> the ID of the template you want the button
   to affect.

# For this example we will only use the first way:

   For this example we will only use the first >method<:

# Removing rows is done via the remove button type.

   Removing rows is done >with< the remove button type.


# The repetition model supports more than just the cases given above, for
# instance there are move-up and move-down buttons that can be inserted inside
# templates much like the remove button but for moving rows up and down.


   The repetition model supports more than just the cases given above>:< move-up
   and move-down buttons <> can be inserted<>>,< much like the remove button>, to
   move< rows up and down.

# order1.name
# order1.quantity
# order1.comment1.text
# order1.comment2.text
# order2.name
# order2.quantity
# order2.comment1.text

Start the numbering with zero, not one.


3.1.1 What the reptition model can't do
---------------------------------------

# This specification also does not address the ability to select a template to
# move it up or down without using buttons directly associated with the current
# template.

   This specification also does not address the ability to select a >repetition
   block< to move it up or down without using buttons directly associated with
   the current >repetition block<.


3.2 Definitions
---------------

# Note: In this section, a number of references are made to namespaces.

   Note: This section makes many references to namespaces.


3.2.1 Repetition Templates
--------------------------

# Authors may use "title" attributes on templates (if they are in the HTML
# namespace) to describe their purpose. Assistive technologies may then use
# these descriptions to help users. (Note, though, that such titles would get
# propagated to the repetition blocks too.)

Remove this paragraph.


3.2.2 Reptition block
---------------------

# it can only take part in certain aspects of the repetition model (namely
# deletion and movement, and not addition).

   it can only take part in certain aspects of the repetition model (namely
   deletion and movement> but< not addition).


3.3 New form controls
---------------------

# Invoking these buttons generates events (for instance click), as specified by
# the DOM specifications.

   Invoking these buttons generates events (>such as< click), as specified by
   the DOM specifications.

Ian, you need to learn the difference between "for example", "for instance", and
"such as". They are not completely interchangeable. "For instance", for example,
introduces an *instance* to contemplate. 'click' here is is an examplar.
"Such as" introduces examples as nouns. "For example" works better with longer
bits of phrasing. No, don't reply to that. Just think about it; I don't think
you've bothered to do so as yet.


3.4 -> 3.5
----------

   No minor editorial comments (yet).


3.5.1 Addition
--------------

# If an add button is activated, and it has a template attribute, and the
# element, in the same document, with the ID given by the template attribute in
# question, is a repetition template as defined above, then that element's
# template replication behaviour is invoked. (Specifically, in scripting-aware
# environments, the element's addRepetitionBlock() method is called with a null
# argument.)

   If an add button >with a template attribute< is activated<> and >its template
   attribute gives the ID of an element in the document that is a repetition
   template< as defined above, then that >template's< replication behaviour is
   invoked. (Specifically, in scripting-aware environments, the >template<
   element's addRepetitionBlock() method is called with a null argument.)

# If an add button is activated, and it has no template attribute, but the
# element has an ancestor that is a repetition block that is not an orphan
# repetition block, then the repetition template associated with that
# repetition block has its template replication behaviour invoked with the
# respective repetition block as its argument. (Specifically, in
# scripting-aware environments, the element's addRepetitionBlock() method is
# called with a reference to the DOM Element node that represents the
# repetition block.)


   If an add button >without a template attribute< is activated<> and it has
   <> an ancestor that is a repetition block that is not an orphan<>, then the
   repetition template associated with that repetition block has its template
   replication behaviour invoked with the <>repetition block as its argument.
   (Specifically, in scripting-aware environments, the >template's<
   addRepetitionBlock() method is called with a reference to the DOM Element
   node that represents the repetition block.)

# The template examines its following siblings, up to the next repetition
# template or the end of the block, whichever comes first. For each sibling
# that is a repetition block (as defined above),

   The template examines its following siblings, up to the next repetition
   template or the end of the >parent<, whichever comes first. For each sibling
   that is a repetition block<>,

# This is performed without paying attention to the types of attributes, and is
# done to all descendants, even those inside nested forms, nested repetition
# templates, and so forth.

   This is performed >regardless of< the types of >the< attributes<> and is
   done to all descendants, even those inside nested forms, nested repetition
   templates, >etc.<

# The attribute from which the template's name was derived, if any, is removed
# from the new repetition block element. (See the previous two steps.)

   The attribute from which the template's name was derived, if any, is removed
   from the new repetition block element. <>

# If the first argument to the method was null, or if the argument to the
# function does not designate a repetition block belonging to this repetition
# template, then the new element is inserted into the parent of the template,
# immediately after the last repetition block found in the first step above, or
# after the template itself if there were no such repetition blocks.

   If the first argument to the method was null> or did< not designate a
   repetition block belonging to this repetition template, then the new element
   is inserted >as a sibling of the< template, immediately after the last
   repetition block found in the first step above>^>8212;<or after the template
   itself if there were no such repetition blocks.

# Otherwise, the new element is inserted into the parent of the template,
# immediately before the node passed as the method's argument.

   Otherwise, the new element is inserted >as a sibling< of the template,
   immediately before the node passed as the method's argument.

9 and 10 ("If the first argument..." and "Otherwise,") should be combined
into a single list item, as they represent a single step in the process.

# In addition, user agents must automatically disable add buttons (irrespective
# of the value of the disabled DOM attribute) when the buttons are not in a
# repetition block and their template attribute is either not specified or does
# not have an ID that points to a repetition template.

   <> >U<ser agents must automatically disable add buttons (irrespective
   of the value of the disabled DOM attribute) when the buttons are not in a
   repetition block and their template attribute is either not specified or does
   not have an ID that points to a repetition template.


3.5.2 Removal
-------------

# When a repetition block's deletion behaviour is invoked (specifically, when
# its removeRepetitionBlock()  method is called) the following is performed:
#
#   1. The node is removed from its parent, if it has one. Mutation events are
#      fired if appropriate.
#   2. A removed event in the uuid:df8b2cc7-6f97-4386-b841-e3fbce5b9647
#      namespace, which bubbles but is not cancellable and has no default
#      action, is fired on the element's repetition template, if it has one,
#      with the repetition block's DOM node as the context information.
#
# This occurs even if the repetition block is an orphan repetition block
# (although if it is, the event is not fired).

   When a repetition block's deletion behaviour is invoked (specifically, when
   its removeRepetitionBlock() method is called) the following is performed:

     1. The node is removed from its parent, if it has one. Mutation events are
        fired if appropriate. >(This occurs even if the repetition block is an
        orphan repetition block.)<
     2. >If the repetition block is not an orphan, a< removed event in the
        uuid:df8b2cc7-6f97-4386-b841-e3fbce5b9647 namespace, which bubbles but
        is not cancellable and has no default action, is fired on the element's
        repetition template, if it has one, with the repetition block's DOM node
        as the context information.
   <>


3.5.3 Movement of repetition blocks
-----------------------------------

3 and 4 ("If distance is negative..." and "Otherwise,") should be combined
into a single list item, as they represent a single step in the process.

# In addition, user agents must automatically disable move-up buttons

   <> >U<ser agents must automatically disable move-up buttons


3.5.4 Initial repetition blocks
-------------------------------

3 and 4 ("If a repetition template was found..." and "Otherwise,") should be
combined into a single list item, as they represent a single step in the
process.


3.5.5. Notes for assistive technologies
---------------------------------------

# Assistive technologies can therefore use normal DOM navigation and mutation
# event listeners to help present repetition sections to the user.

   Assistive technologies can >thereby< use normal DOM navigation and mutation
   event listeners to help present repetition sections to the user.


3.6.1 Repeated rows
-------------------

# <tr repeat="repeated">

<tr repeat="0">

# Initially, two rows would be visible, each with two text input fields, the
# first row having the values "John Smith" and "2", the second row having the
# values "" (a blank text field) and "1".

   Initially, two rows would be visible, each with two text input fields>. T<he
   first row>'s fields would have< the values "John Smith" and "2", the second
   row <> the values "" (a blank text field) and "1".


3.6.2 Nested repeats
--------------------

# The previous example does not demonstrate nested repeat blocks, reordering
# repetition blocks, and inserting new repetition blocks in the middle of the
# existing sequence, all of which are possible using the facilities described
# above.

   The previous example does not demonstrate nested repeat blocks, reordering
   repetition blocks, >or< inserting new repetition blocks in the middle of the
   existing sequence, all of which are possible using the facilities described
   above.

=== End section 3 ===

~fantasai

-- 
http://fantasai.inkedblade.net/contact









More information about the whatwg mailing list