File: form.bt

package info (click to toggle)
tk-html3 3.0~fossil20110109-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,644 kB
  • ctags: 5,882
  • sloc: ansic: 48,994; tcl: 26,030; sh: 1,190; yacc: 161; makefile: 24
file content (46 lines) | stat: -rw-r--r-- 1,216 bytes parent folder | download | duplicates (5)
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

#
# The focus of this module is the HTMLFormElement object - the
# thing created by a <FORM> tag in a document.
#
set ::Doc {
  <HTML>
    <BODY>
     <FORM name=one>
       <INPUT type=text name="i_one"></INPUT>
       <INPUT type=text name="i_one"></INPUT>
       <INPUT type=text name="i_two"></INPUT>
       <INPUT type=text id="i_three"></INPUT>
       <INPUT type=text name="i_four"></INPUT>
       <INPUT type=text id="i_four"></INPUT>
     </FORM>
   </BODY>
  </HTML>
}

# forms.one.i_one   -> NodeList
# forms.one.i_two   -> HTMLInputElement
# forms.one.i_three -> HTMLInputElement
# forms.one.i_four  -> NodeList

# The reference to forms[0].i_one is a collection, because
# there is more than one element named i_one.
#
do_browser_test forms.1 -html $::Doc -javascript {
  return document.forms.one.i_one.length
} -expected 2

# But forms[0].i_two is the HTMLInputElement.
#
do_browser_test forms.2 -html $::Doc -javascript {
  return document.forms[0].i_two.type
} -expected "text"

do_browser_test forms.3 -html $::Doc -javascript {
  return document.forms[0].i_three.type
} -expected "text"

do_browser_test forms.4 -html $::Doc -javascript {
  return document.forms[0].i_four.length
} -expected 2