Summary
<function> domains do not currently support union syntax in attribute text (for example domain="(-4,-1) union (1,4)").
When this syntax is used, parsing fails and the function falls back to an all-real-line domain.
Reproduction
<graph renderer="doenet" name="g">
<shortDescription>test graph</shortDescription>
<function domain="(-4,-1) union (1,4)">x^2</function>
</graph>
Actual behavior
- The function appears defined everywhere.
- The function's
domain state value appears to be the full real line.
- Warnings include:
Insufficient dimensions for domain for function. Domain has 0 intervals but the function has 1 input.
Invalid format for domain for function.
Expected behavior
For single-variable functions, union domains should be accepted and enforced, so the function is only defined on (-4,-1) ∪ (1,4).
Source analysis
Two places contribute to the fallback behavior:
packages/doenetml-worker-javascript/src/components/IntervalList.js
breakEmbeddedStringsIntoIntervalPieces rejects non-whitespace tokens at top level, so union causes parse failure.
packages/doenetml-worker-javascript/src/components/Function.js
- Domain validation expects one interval per input dimension and only accepts trees with root
"interval".
- On mismatch/invalid format, it emits warnings and falls back to infinite domain.
Impact
This issue is in shared function domain state computation (not specific to a single renderer).
Summary
<function>domains do not currently support union syntax in attribute text (for exampledomain="(-4,-1) union (1,4)").When this syntax is used, parsing fails and the function falls back to an all-real-line domain.
Reproduction
Actual behavior
domainstate value appears to be the full real line.Insufficient dimensions for domain for function. Domain has 0 intervals but the function has 1 input.Invalid format for domain for function.Expected behavior
For single-variable functions, union domains should be accepted and enforced, so the function is only defined on
(-4,-1) ∪ (1,4).Source analysis
Two places contribute to the fallback behavior:
packages/doenetml-worker-javascript/src/components/IntervalList.jsbreakEmbeddedStringsIntoIntervalPiecesrejects non-whitespace tokens at top level, sounioncauses parse failure.packages/doenetml-worker-javascript/src/components/Function.js"interval".Impact
This issue is in shared function domain state computation (not specific to a single renderer).