aboutsummaryrefslogtreecommitdiff
path: root/doc/ref/javascript/input_list.texi
blob: e22d4c2b48495e929f40d11dd03dfda1ffacadb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@node input_list
@section input_list.js
@cindex dummy component

All elements with the class @code{input-list} are treated as a
collection of input fields. Uses including setting tags on calendar
entries.

All direct children of the ``input-list'' @emph{must} have the class
@code{unit}, and one direct child @code{unit} have the class @code{final}.

@c All elements having 'input-list' ∈ =class=

@c Direct children must all have 'unit' ∈ =class=
@c One direct child must have 'final' ∈ =class=

@defmethod input_list get_value

@example
querySelectorAll('input')
        .map(x => x.value)
        .join(@var{joinby})
@end example
@end defmethod

@defivar input_list [data-]joinby
 Alternative character to join by
@end defivar

@defivar input_list [data-]bindby
 replacement for get_value
@end defivar

binds =get_value= on instances, by default returning the value
of all =<input/>= tags joined by =,=. This can be overwritten with

TODO: instead, override value?

=addEventList('input',= is overwritten, registering the listener for all input
elements.


  ∀ children('.input-list') => 'unit' ∈ classList(child)

  <div class="input-list">
    <div class="unit"><input/></div>
    <div class="unit final"><input/></div>
  </div>

@defun init_input_list
@end defun