about summary refs log tree commit diff stats
path: root/test/js/reflect.html
blob: 9b2ed4cb98aa7004ea795a8ca315247054a59ff0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!doctype html>
<div id=abc>Fail</div>
<a class=claz target="abcd">test test</a>
<script src=asserts.js></script>
<script>
const x = document.getElementById("abc")
const a = document.getElementsByTagName("a")[0];
assert_equals(a.target, "abcd");
a.target = "defg";
assert_equals(a.target, "defg");
assert_equals(a.relList + "", "");
a.relList = "...";
assert_equals(a.relList + "", "...");
assert_equals(a.className, "claz");
x.textContent = "Success";
a.remove(); /* ignore target... */
</script>
"TypeMismatchError": 17u16, "SecurityError": 18u16, "NetworkError": 19u16, "AbortError": 20u16, "URLMismatchError": 21u16, "QuotaExceededError": 22u16, "TimeoutError": 23u16, "InvalidNodeTypeError": 24u16, "DataCloneError": 25u16 }.toTable() type DOMException* = ref object of JSError name* {.jsget.}: string DOMResult*[T] = Result[T, DOMException] jsDestructor(DOMException) proc newDOMException*(message = "", name = "Error"): DOMException {.jsctor.} = return DOMException( e: JS_DOM_EXCEPTION, name: name, message: message ) template errDOMException*(message, name: string): untyped = err(newDOMException(message, name)) func message0(this: DOMException): string {.jsfget: "message".} = return this.message func code(this: DOMException): uint16 {.jsfget.} = return NamesTable.getOrDefault(this.name, 0u16) proc addDOMExceptionModule*(ctx: JSContext) = ctx.registerType(DOMException, JS_CLASS_ERROR, errid = opt(JS_DOM_EXCEPTION))