[Ur] Body onload handlers do not cause scripts to be included

Istvan Chung istvan at vivatropolis.org
Sat Mar 9 14:13:01 EST 2013


If a page is created in which the only indicator that javascript must be
used is the <body onload={...}> tag, then the compiler fails to
recognize that it must insert the <script> tags in the head of the page.

For example,

fun main () =
return <xml>
  <head>
    <title>Example</title>
  </head>

  <body onload={alert "Client-side code"}>
  </body>
</xml>

does not alert anything because the application's script is not
included. If, for example, a button with a handler is added to the page:

<button onclick={alert "More client-side code"} />

both alerts will occur (the latter on a button press) because with the
addition of the button, the compiler realizes that javascript must be
used on this page. Is this a bug, or is the <body onload={...}> handler
not meant to be used in this way?

-- 
Istvan Chung



More information about the Ur mailing list