Water 5-User Interface-HTML Layout
class hypertext
Contract
Parameter keyDefault valueType
aliases<vector "html"/>vector
idopt
classopt
langopt
langopt
dir"ltr"type.<one_of "ltr" "rtl"/>
onclickopt
ondblclickopt
onmousedownopt
onmouseupopt
onmouseoveropt
onmousemoveopt
onmouseoutopt
onkeypressopt
onkeydownopt
onkeyupopt
accesskeyopt
tabindexoptinteger
onfocusopt
onbluropt
Parameter kindDefault valueType
Other keyed argumentsopt
Water Contract
<class hypertext
  aliases       =<vector "html"/>
  id            =opt
  class         =opt
  <a href='/xmlns/"http://www/w3/org/1999/xml"/lang.htm'>lang</a>=opt
  lang          =opt
  dir           ="ltr"=<type.one_of "ltr" "rtl"/>
  onclick       =opt
  ondblclick    =opt
  onmousedown   =opt
  onmouseup     =opt
  onmouseover   =opt
  onmousemove   =opt
  onmouseout    =opt
  onkeypress    =opt
  onkeydown     =opt
  onkeyup       =opt
  accesskey     =opt
  tabindex      =opt=number.integer
  onfocus       =opt
  onblur        =opt
  _other_keyed  =opt=wob="_add_to_environment"
/>
hypertext is a Water class that contains subclasses for every XHTML tag. Each tag has a contract that matches the XHTML spec. Older tags and attributes are not supported by default. To support HTML tags used in versions prior to XHTML 1.0, execute the following:
<resource "logical://system/water_extras/code/hypertext_html.h2o"/>.<execute/>
You can create subclasses of HTML tags. When the object is formatted as HTML, it will print the standard tag name, but all the fields will be shown. This makes it easy to create HTML-based presentation abstractions.
<class hypertext.SELECT.multilist size=5 multiple=true />
thing.hypertext.select.multilist 
<DIV>To select multiple things, use the "Ctrl" key.</DIV>
<SELECT.multilist><OPTION "foo"/><OPTION "bar"/></>
By default, any attribute that is not a string will be converted to a string by calling cxs_medium . Exceptions: (a higher priority rules are listed first) Water defines every XHTML tag as a subclass of the hypertext class under thing. Thus thing.hypertext.b is a class for the 'bold' tag. When you make a call to an html tag, i.e. <b>hi</b> , an instance of that tag's class is made containing the content and attributes specified as fields in the new instance. XHTML specifies that each tag's attributes must be named and must have values of strings. Water permits that but also allows you to have by-position arguments and non-strings as values, just like other Water calls. Most XHTML attributes are of execution kind "ek_code". XHTML specifies that all tag names and attribute names are lower case. Water defines lower case tags as well as an upper case version of each tag for compatibility with a common practice in html of upper casing tags. HTML tags that have upper case attribute names have their attribute names automatically converted to lower case equivalents upon object creation for compatibility with XHTML. Thus:
<A HREF="abc.com">click</>.href
"abc.com"
but:
<A HREF="abc.com">click</>.HREF
error
errors since there is no key in the a tag instance that is spelled "HREF".
<A href="abc.com">click</>
is a synonym for the above and the preferred XHTML syntax. To explicitly see the HTML formatting of a tag, call the to_htm method on the object:
<b> hi </>.<to_htm/>"<b> hi </b>"
You can also see the HRML by clicking right in the lower right pane and choosing to inspect the HTML source. Use html_to_xhtml to clean up old html code before executing it in Water. Caveats: The lower right browser pane in the development environment can't render every tag, at least in the way that modern browsers do. Use the tools menu "Browse Latest Result" to see it in a real browser. See html_to_xhtml for how to convert HTML into XHTML.

Hypertext Subclass

Subclassing a hypertext tag will use the tagname from the original HTML tag. To show the attributes of the subclass, use copy_down_data in the make method.
<class hypertext.P.P3 class="P3">
 <method make> .<copy_down_data/> </>
</>
<P.P3>hello</>.<to_htm/>
'<p class="P3">hello</p>'