diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/mathml/support/operator-dictionary.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/mathml/support/operator-dictionary.js')
-rw-r--r-- | testing/web-platform/tests/mathml/support/operator-dictionary.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mathml/support/operator-dictionary.js b/testing/web-platform/tests/mathml/support/operator-dictionary.js new file mode 100644 index 0000000000..ee1de102fe --- /dev/null +++ b/testing/web-platform/tests/mathml/support/operator-dictionary.js @@ -0,0 +1,42 @@ +async function fetchOperatorDictionary() { + let response = await fetch(`/mathml/support/operator-dictionary.json`); + return response.json(); +} + +function splitKey(key) { + var value = key.split(" ") + return { + characters: value[0], + form: value[1] + }; +} + +function spaceIndexToLength(index) { + // See https://w3c.github.io/mathml-core/#operator-dictionary + return ["0", + "0.05555555555555555em", + "0.1111111111111111em", + "0.16666666666666666em", + "0.2222222222222222em", + "0.2777777777777778em", + "0.3333333333333333em", + "0.3888888888888889em" + ][index]; +} + +function defaultPropertyValue(entry, name) { + switch (name) { + case "lspace": + case "rspace": + return spaceIndexToLength(entry.hasOwnProperty(name) ? entry[name] : 5); + break + case "largeop": + case "movablelimits": + case "stretchy": + case "symmetric": + case "accent": + return entry[name]; + default: + throw `Unknown property ${name}`; + } +} |