SCXML-tutorial

Contents Overview Examples Editor Forum

<script>

Video version

The <script> element adds scripting capability to the state machine.

Example:

<script>print('Hello, world!')</script>

Attribute Details

NameRequiredAttribute ConstraintsDefault ValueValid ValuesDescription
srcfalseMay not occur if the element has children.noneA valid URIGives the location from which the script should be downloaded.

Children

The child content of the <script> element represents the script code to be executed.

A conformant SCXML document must specify either the 'src' attribute or child content, but not both. If 'src' is specified, the SCXML Processor must download the script from the specified location at load time. If the script can not be downloaded within a platform-specific timeout interval, the document is considered non-conformant, and the platform must reject it.

W3C IRP tests

1. Test 301

If the script specified by the 'src' attribute of a script element cannot be downloaded within a platform-specific timeout interval, the document is considered non-conformant, and the platform MUST reject it. N.B. This test is valid only for datamodels that support scripting.

test301

2. Test 302

The SCXML Processor MUST evaluate any script element that is a child of scxml at document load time. N.B. This test is valid only for datamodels that support scripting.

test302

3. Test 303

In a conformant SCXML document, the name of any script variable MAY be used as a location expression. N.B. This test is valid only for datamodels that support scripting.

test303

4. Test 304

In a conformant SCXML document, the name of any script variable MAY be used as a location expression. N.B. This test is valid only for datamodels that support scripting.

test304

TOP Contents Overview Examples Editor Forum