Check-in [a7fd9dfcae]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Get javascript working again. Still not completely right. (CVS 1258)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a7fd9dfcae969337896cb4c77b8619cb48183c72
User & Date: danielk1977 2008-02-03 11:06:56
Context
2008-02-03
11:19
Fix some javascript problems. (CVS 1259) check-in: 0f9ea1c484 user: danielk1977 tags: trunk
11:06
Get javascript working again. Still not completely right. (CVS 1258) check-in: a7fd9dfcae user: danielk1977 tags: trunk
06:29
Fix some problems with history. (CVS 1257) check-in: 583d5c0db5 user: danielk1977 tags: trunk
Changes

Changes to hv/hv3.tcl.

1089
1090
1091
1092
1093
1094
1095


1096
1097
1098
1099
1100
1101
1102
....
2231
2232
2233
2234
2235
2236
2237

2238
2239
2240
2241
2242
2243
2244
    set O(-enableimages) 1

    set O(-scrollbarpolicy) auto

    set O(-locationvar) ""
    set O(-downloadcmd) ""
    set O(-requestcmd) ""



    # Full text of referrer URI, if any.
    #
    # Note that the DOM attribute HTMLDocument.referrer has a double-r,
    # but the name of the HTTP header, "Referer", has only one.
    #
    set O(myReferrer) ""
................................................................................
    upvar #0 $me O
    return $O(hull)
  }
  proc win {me} {
    upvar #0 $me O
    return $O(win)
  }


  proc yview {me args} {
    upvar #0 $me O
    eval $O(html) yview $args
  }
  proc xview {me args} {
    upvar #0 $me O







>
>







 







>







1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
....
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
    set O(-enableimages) 1

    set O(-scrollbarpolicy) auto

    set O(-locationvar) ""
    set O(-downloadcmd) ""
    set O(-requestcmd) ""

    set O(-frame) ""

    # Full text of referrer URI, if any.
    #
    # Note that the DOM attribute HTMLDocument.referrer has a double-r,
    # but the name of the HTTP header, "Referer", has only one.
    #
    set O(myReferrer) ""
................................................................................
    upvar #0 $me O
    return $O(hull)
  }
  proc win {me} {
    upvar #0 $me O
    return $O(win)
  }
  proc me {me} { return $me }

  proc yview {me args} {
    upvar #0 $me O
    eval $O(html) yview $args
  }
  proc xview {me args} {
    upvar #0 $me O

Changes to hv/hv3_browser.tcl.

90
91
92
93
94
95
96

97
98
99
100
101
102
103
...
485
486
487
488
489
490
491
492
493

494
495
496
497
498
499
500
501
...
547
548
549
550
551
552
553




554
555
556
557
558
559
560
    # If "Copy Link Location" has been selected, store the selected text
    # (a URI) in set $O(myCopiedLinkLocation).
    set O(myCopiedLinkLocation) ""
 
    #set O(myHv3)      [::hv3::hv3 $O(win).hv3]
    #pack $O(myHv3) -expand true -fill both
    set O(myHv3) $O(hull)


    ::hv3::the_visited_db init $O(myHv3)

    catch {$O(myHv3) configure -fonttable $::hv3::fontsize_table}

    # Create bindings for motion, right-click and middle-click.
    $O(myHv3) Subscribe motion [list $me motion]
................................................................................

  # Launch the tree browser
  proc browse {me} {
    upvar #0 $me O
    ::HtmlDebug::browse $O(myHv3) [$O(myHv3) node]
  }

  proc hv3 {me} { 
    upvar #0 $me O

    return $O(myHv3) 
  }
  proc browser {me} {
    upvar #0 $me O
    return $O(myBrowser) 
  }
  proc dom {me} { 
    upvar #0 $me O
................................................................................
    upvar #0 $me O
    eval $O(myHv3) dumpforms $args
  }
  proc javascriptlog {me args} {
    upvar #0 $me O
    eval $O(myHv3) javascriptlog $args
  }




}
::hv3::make_constructor ::hv3::browser_frame ::hv3::hv3

# An instance of this widget represents a top-level browser frame (not
# a toplevel window - an html frame not contained in any frameset 
# document). These are the things managed by the notebook widget.
#







>







 







|

>
|







 







>
>
>
>







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
...
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
    # If "Copy Link Location" has been selected, store the selected text
    # (a URI) in set $O(myCopiedLinkLocation).
    set O(myCopiedLinkLocation) ""
 
    #set O(myHv3)      [::hv3::hv3 $O(win).hv3]
    #pack $O(myHv3) -expand true -fill both
    set O(myHv3) $O(hull)
    $O(myHv3) configure -frame me

    ::hv3::the_visited_db init $O(myHv3)

    catch {$O(myHv3) configure -fonttable $::hv3::fontsize_table}

    # Create bindings for motion, right-click and middle-click.
    $O(myHv3) Subscribe motion [list $me motion]
................................................................................

  # Launch the tree browser
  proc browse {me} {
    upvar #0 $me O
    ::HtmlDebug::browse $O(myHv3) [$O(myHv3) node]
  }

  proc hv3 {me args} { 
    upvar #0 $me O
    if {[llength $args] == 0} {return $O(myHv3)}
    eval $O(myHv3) $args
  }
  proc browser {me} {
    upvar #0 $me O
    return $O(myBrowser) 
  }
  proc dom {me} { 
    upvar #0 $me O
................................................................................
    upvar #0 $me O
    eval $O(myHv3) dumpforms $args
  }
  proc javascriptlog {me args} {
    upvar #0 $me O
    eval $O(myHv3) javascriptlog $args
  }

  proc me {me} {
    return $me
  }
}
::hv3::make_constructor ::hv3::browser_frame ::hv3::hv3

# An instance of this widget represents a top-level browser frame (not
# a toplevel window - an html frame not contained in any frameset 
# document). These are the things managed by the notebook widget.
#

Changes to hv/hv3_dom.tcl.

1
2
3
4
5
6
7
8
...
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194
195
...
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
namespace eval hv3 { set {version($Id: hv3_dom.tcl,v 1.93 2008/01/06 08:45:28 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# Snit types in this file:
#
#     ::hv3::dom                       -- One object per js interpreter. 
#     ::hv3::dom::logdata              -- Data for js debugger
#     ::hv3::dom::logwin               -- Js debugger GUI
................................................................................
  #
  #     $htmlwidget handler script script [list $dom script]
  #
  # This is done externally, not by code within this type definition.
  # If scripting is not enabled in this browser, this method is a no-op.
  #
  method script {hv3 attr script} {

    if {$mySee ne ""} {
      $hv3 write wait
      array set a $attr
      if {[info exists a(src)]} {
        set fulluri [$hv3 resolve_uri $a(src)]
        set handle [::hv3::request %AUTO%             \
            -uri         $fulluri                      \
            -mimetype    text/javascript               \
            -cachecontrol normal                       \
................................................................................
  # of the <noscript> block back to the parser using the same
  # Tcl interface used for document.write().
  #
  method noscript {hv3 attr script} {
    if {$mySee ne ""} {
      return ""
    } else {
      [$hv3 html] write text $script
    }
  }
  
  # If a <SCRIPT> element has a "src" attribute, then the [script]
  # method will have issued a GET request for it. This is the 
  # successful callback.
  #
................................................................................
    }

    set name [$self NewFilename]
    set w [list ::hv3::DOM::Window $self $hv3]
    set rc [catch {$mySee eval -window $w -noresult -file $name $script} msg]

    $self Log $title $name $script $rc $msg
    $hv3 write continue
  }

  method javascript {hv3 script} {
    set msg ""
    if {$mySee ne ""} {
      set name [$self NewFilename]
      if {$hv3 eq ""} {set hv3 [$myBrowser hv3]}
................................................................................
  }

  #----------------------------------------------------------------
  # Given an html-widget node-handle, return the corresponding 
  # ::hv3::hv3 object. i.e. the owner of the node-handle.
  #
  method node_to_hv3 {node} {
    set html [$node html]
    winfo parent [winfo parent $html]
  }

  method node_to_frame {node} {
    winfo parent [$self node_to_hv3 $node]
  }

  # Given a Tkhtml3 node-handle, return the javascript wrapper 
  # for the containing window. 
  #
  method node_to_window {node} {
    set hv3 [$self node_to_hv3 $node]
................................................................................
    # If javascript is enabled and Window object being cleared
    # is the top-level frame, delete and recreated the SEE interpreter.
    # This is necessary, in case the previous URI was in the 
    # "home://" namespace.
    #
    # Also, reset the debugging gui here.
    #
    if {$mySee ne ""} {
      set frame [winfo parent $hv3]
      if {$frame eq [$frame top_frame]} {
        foreach win [array names myWindows] {
          $mySee make_transient [list ::hv3::DOM::Window $self $hv3]
        }
        $self LogReset
        $mySee destroy
|







 







>

|







 







|







 







|







 







<
|



|







 







|







1
2
3
4
5
6
7
8
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
414
415
416
417
418
419
420

421
422
423
424
425
426
427
428
429
430
431
432
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
namespace eval hv3 { set {version($Id: hv3_dom.tcl,v 1.94 2008/02/03 11:06:56 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# Snit types in this file:
#
#     ::hv3::dom                       -- One object per js interpreter. 
#     ::hv3::dom::logdata              -- Data for js debugger
#     ::hv3::dom::logwin               -- Js debugger GUI
................................................................................
  #
  #     $htmlwidget handler script script [list $dom script]
  #
  # This is done externally, not by code within this type definition.
  # If scripting is not enabled in this browser, this method is a no-op.
  #
  method script {hv3 attr script} {

    if {$mySee ne ""} {
      $hv3 html write wait
      array set a $attr
      if {[info exists a(src)]} {
        set fulluri [$hv3 resolve_uri $a(src)]
        set handle [::hv3::request %AUTO%             \
            -uri         $fulluri                      \
            -mimetype    text/javascript               \
            -cachecontrol normal                       \
................................................................................
  # of the <noscript> block back to the parser using the same
  # Tcl interface used for document.write().
  #
  method noscript {hv3 attr script} {
    if {$mySee ne ""} {
      return ""
    } else {
      $hv3 html write text $script
    }
  }
  
  # If a <SCRIPT> element has a "src" attribute, then the [script]
  # method will have issued a GET request for it. This is the 
  # successful callback.
  #
................................................................................
    }

    set name [$self NewFilename]
    set w [list ::hv3::DOM::Window $self $hv3]
    set rc [catch {$mySee eval -window $w -noresult -file $name $script} msg]

    $self Log $title $name $script $rc $msg
    $hv3 html write continue
  }

  method javascript {hv3 script} {
    set msg ""
    if {$mySee ne ""} {
      set name [$self NewFilename]
      if {$hv3 eq ""} {set hv3 [$myBrowser hv3]}
................................................................................
  }

  #----------------------------------------------------------------
  # Given an html-widget node-handle, return the corresponding 
  # ::hv3::hv3 object. i.e. the owner of the node-handle.
  #
  method node_to_hv3 {node} {

    [winfo parent [$node html]] hv3 me
  }

  method node_to_frame {node} {
    [winfo parent [$node html]] me
  }

  # Given a Tkhtml3 node-handle, return the javascript wrapper 
  # for the containing window. 
  #
  method node_to_window {node} {
    set hv3 [$self node_to_hv3 $node]
................................................................................
    # If javascript is enabled and Window object being cleared
    # is the top-level frame, delete and recreated the SEE interpreter.
    # This is necessary, in case the previous URI was in the 
    # "home://" namespace.
    #
    # Also, reset the debugging gui here.
    #
    if {0 && $mySee ne ""} {
      set frame [winfo parent $hv3]
      if {$frame eq [$frame top_frame]} {
        foreach win [array names myWindows] {
          $mySee make_transient [list ::hv3::DOM::Window $self $hv3]
        }
        $self LogReset
        $mySee destroy

Changes to hv/hv3_dom_core.tcl.

1
2
3
4
5
6
7
8
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
namespace eval hv3 { set {version($Id: hv3_dom_core.tcl,v 1.38 2007/11/11 11:00:47 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# DOM Level 1 Core
#
# This file contains the Hv3 implementation of the DOM Level 1 Core. Where
# possible, Hv3 tries hard to be compatible with W3C and Gecko. Gecko
# is pretty much a clean super-set of W3C for this module.
................................................................................
  #     createTextNode()
  #     createDocumentFragment()     (todo)
  #     createComment()              (todo)
  #     createAttribute()            (todo)
  #     createEntityReference()      (todo)
  #
  dom_call -string createElement {THIS tagname} {
    set node [$myHv3 fragment "<$tagname>"]
    if {$node eq ""} {error "DOMException NOT_SUPPORTED_ERR"}
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }
  dom_call -string createTextNode {THIS data} {
    if {$data eq ""} {
      # Special case - The [fragment] API usually parses an empty string
      # to an empty fragment. So create a text node with text "X", then 
      # set the text to an empty string.
      set node [$myHv3 fragment X]
      $node text set ""
    } else {
      set escaped [string map {< &lt; > &gt;} $data]
      set node [$myHv3 fragment $escaped]
    }
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }
  dom_call_todo createDocumentFragment
  dom_call_todo createComment
  dom_call_todo createAttribute
  dom_call_todo createEntityReference
|







 







|








|



|







1
2
3
4
5
6
7
8
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
namespace eval hv3 { set {version($Id: hv3_dom_core.tcl,v 1.39 2008/02/03 11:06:56 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# DOM Level 1 Core
#
# This file contains the Hv3 implementation of the DOM Level 1 Core. Where
# possible, Hv3 tries hard to be compatible with W3C and Gecko. Gecko
# is pretty much a clean super-set of W3C for this module.
................................................................................
  #     createTextNode()
  #     createDocumentFragment()     (todo)
  #     createComment()              (todo)
  #     createAttribute()            (todo)
  #     createEntityReference()      (todo)
  #
  dom_call -string createElement {THIS tagname} {
    set node [$myHv3 html fragment "<$tagname>"]
    if {$node eq ""} {error "DOMException NOT_SUPPORTED_ERR"}
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }
  dom_call -string createTextNode {THIS data} {
    if {$data eq ""} {
      # Special case - The [fragment] API usually parses an empty string
      # to an empty fragment. So create a text node with text "X", then 
      # set the text to an empty string.
      set node [$myHv3 html fragment X]
      $node text set ""
    } else {
      set escaped [string map {< &lt; > &gt;} $data]
      set node [$myHv3 html fragment $escaped]
    }
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }
  dom_call_todo createDocumentFragment
  dom_call_todo createComment
  dom_call_todo createAttribute
  dom_call_todo createEntityReference

Changes to hv/hv3_dom_html.tcl.

1
2
3
4
5
6
7
8
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
namespace eval hv3 { set {version($Id: hv3_dom_html.tcl,v 1.46 2007/11/25 18:29:15 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# DOM Level 1 Html
#
# This file contains the Hv3 implementation of the DOM Level 1 Html. Where
# possible, Hv3 tries hard to be compatible with W3C and Gecko. Gecko
# is pretty much a clean super-set of W3C for this module.
................................................................................
  #
  # This returns a single object (or NULL if an object of the specified
  # id cannot be found).
  #
  dom_call -string getElementById {THIS elementId} {
    set elementId [string map [list "\x22" "\x5C\x22"] $elementId]
    set selector [subst -nocommands {[id="$elementId"]}]
    set node [$myHv3 search $selector -index 0]
    if {$node ne ""} {
      return [list object [::hv3::dom::wrapWidgetNode $myDom $node]]
    }
    return null
  }

  #-------------------------------------------------------------------------
................................................................................
      form[name="$property"],img[name="$property"]
    }]
    set idselector [subst -nocommands {
      form[id="$property"],img[id="$property"]
    }]
 
    foreach selector [list $nameselector $idselector] {
      set node [$myHv3 search $selector -index 0]
      if {$node ne ""} {
        return [list object [::hv3::dom::wrapWidgetNode $myDom $node]]
      }
    }

    list
  }
|







 







|







 







|







1
2
3
4
5
6
7
8
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
namespace eval hv3 { set {version($Id: hv3_dom_html.tcl,v 1.47 2008/02/03 11:06:56 danielk1977 Exp $)} 1 }

#--------------------------------------------------------------------------
# DOM Level 1 Html
#
# This file contains the Hv3 implementation of the DOM Level 1 Html. Where
# possible, Hv3 tries hard to be compatible with W3C and Gecko. Gecko
# is pretty much a clean super-set of W3C for this module.
................................................................................
  #
  # This returns a single object (or NULL if an object of the specified
  # id cannot be found).
  #
  dom_call -string getElementById {THIS elementId} {
    set elementId [string map [list "\x22" "\x5C\x22"] $elementId]
    set selector [subst -nocommands {[id="$elementId"]}]
    set node [$myHv3 html search $selector -index 0]
    if {$node ne ""} {
      return [list object [::hv3::dom::wrapWidgetNode $myDom $node]]
    }
    return null
  }

  #-------------------------------------------------------------------------
................................................................................
      form[name="$property"],img[name="$property"]
    }]
    set idselector [subst -nocommands {
      form[id="$property"],img[id="$property"]
    }]
 
    foreach selector [list $nameselector $idselector] {
      set node [$myHv3 html search $selector -index 0]
      if {$node ne ""} {
        return [list object [::hv3::dom::wrapWidgetNode $myDom $node]]
      }
    }

    list
  }

Changes to hv/hv3_dom_ns.tcl.

1
2
3
4
5
6
7
8
...
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
namespace eval hv3 { set {version($Id: hv3_dom_ns.tcl,v 1.39 2007/11/26 03:28:23 danielk1977 Exp $)} 1 }

#---------------------------------
# List of DOM objects in this file:
#
#     Navigator
#     Window
#     Location
................................................................................
    set h ""
    if {[llength $args] > 0} {
      set w " width=[lindex $args 0 1]"
    }
    if {[llength $args] > 1} {
      set h " height=[lindex $args 0 1]"
    }
    set node [$myHv3 fragment "<img${w}${h}>"]
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }

  #-----------------------------------------------------------------------
  # The "XMLHttpRequest" property object. This is so that scripts can
  # do the following:
  #
|







 







|







1
2
3
4
5
6
7
8
...
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
namespace eval hv3 { set {version($Id: hv3_dom_ns.tcl,v 1.40 2008/02/03 11:06:56 danielk1977 Exp $)} 1 }

#---------------------------------
# List of DOM objects in this file:
#
#     Navigator
#     Window
#     Location
................................................................................
    set h ""
    if {[llength $args] > 0} {
      set w " width=[lindex $args 0 1]"
    }
    if {[llength $args] > 1} {
      set h " height=[lindex $args 0 1]"
    }
    set node [$myHv3 html fragment "<img${w}${h}>"]
    list object [::hv3::dom::wrapWidgetNode $myDom $node]
  }

  #-----------------------------------------------------------------------
  # The "XMLHttpRequest" property object. This is so that scripts can
  # do the following:
  #

Changes to hv/hv3_form.tcl.

1
2
3
4
5
6
7
8
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
....
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
namespace eval hv3 { set {version($Id: hv3_form.tcl,v 1.96 2008/01/27 06:01:35 danielk1977 Exp $)} 1 }

###########################################################################
# hv3_form.tcl --
#
#     This file contains code to implement Html forms for Tkhtml based
#     browsers. The only requirement is that no other code register for
#     node-handler callbacks for <input>, <button> <select> or <textarea> 
................................................................................
  # <INPUT type="file"> controls.
  #
  method filename {} { return "" }

  # Reset the state of the control.
  #
  method reset {} {
    puts "TODO: ::hv3::forms::radio reset"
  }

  # TODO: The sole purpose of this is to return a linebox offset...
  method configurecmd {values} { 
    ::hv3::forms::configurecmd $win [$hull cget -font]
  }

................................................................................
  }

  method reset {} {
    array unset myClickControls
  }

  method dumpforms {} {
    foreach node [$myHv3 search form] {
      set form [$node replace]
      puts [$form dump]
    }
  }

  method clickhandler {node} {
    if {[info exists myClickControls($node)]} {
|







 







|







 







|







1
2
3
4
5
6
7
8
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
....
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
namespace eval hv3 { set {version($Id: hv3_form.tcl,v 1.97 2008/02/03 11:06:56 danielk1977 Exp $)} 1 }

###########################################################################
# hv3_form.tcl --
#
#     This file contains code to implement Html forms for Tkhtml based
#     browsers. The only requirement is that no other code register for
#     node-handler callbacks for <input>, <button> <select> or <textarea> 
................................................................................
  # <INPUT type="file"> controls.
  #
  method filename {} { return "" }

  # Reset the state of the control.
  #
  method reset {} {
    #puts "TODO: ::hv3::forms::radio reset"
  }

  # TODO: The sole purpose of this is to return a linebox offset...
  method configurecmd {values} { 
    ::hv3::forms::configurecmd $win [$hull cget -font]
  }

................................................................................
  }

  method reset {} {
    array unset myClickControls
  }

  method dumpforms {} {
    foreach node [$myHv3 html search form] {
      set form [$node replace]
      puts [$form dump]
    }
  }

  method clickhandler {node} {
    if {[info exists myClickControls($node)]} {

Changes to tests/tree1.bt.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#----------------------------------------------------------------------
# A "warm-body" test to check that the infrastructure is working.
# Count the anchors in a document.
#
browsertest warmbody.1 {
  <BODY>
    <A name="one">One</A>
    <A id="two">Two</A>          <!-- Not an anchor (no "name" attribute) -->
    <A name="three">Three</A>
  <SCRIPT>
    function browsertest () {

      return document.anchors.length
    }
  </SCRIPT>
} 
#----------------------------------------------------------------------

proc body_tree_test {name doc} {

  # Uses:
  #
  #     Node.childNodes
................................................................................
      function dom_tree () {
        return node_to_string(document)
      }

    </SCRIPT>
  }

  browsertest $name [string trim "
    $body_tree_function
    $doc
    <SCRIPT>
      function browsertest () { return dom_tree() }
    </SCRIPT>
  "]






|




<
<
>
|
|
<
<







 







|







1
2
3
4
5
6
7
8
9
10


11
12
13


14
15
16
17
18
19
20
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

#----------------------------------------------------------------------
# A "warm-body" test to check that the infrastructure is working.
# Count the anchors in a document.
#
do_browser_test warmbody.1 -html {
  <BODY>
    <A name="one">One</A>
    <A id="two">Two</A>          <!-- Not an anchor (no "name" attribute) -->
    <A name="three">Three</A>


} -javascript {
  return document.anchors.length
}


#----------------------------------------------------------------------

proc body_tree_test {name doc} {

  # Uses:
  #
  #     Node.childNodes
................................................................................
      function dom_tree () {
        return node_to_string(document)
      }

    </SCRIPT>
  }

  browsertest $name utf-8 [string trim "
    $body_tree_function
    $doc
    <SCRIPT>
      function browsertest () { return dom_tree() }
    </SCRIPT>
  "]