Skip to content

Commit

Permalink
Make semantics/interfaces.html more extensible.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Apr 29, 2015
1 parent 74fc6fb commit d9e8907
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions html/semantics/interfaces.html
Expand Up @@ -9,22 +9,24 @@
<script src=interfaces.js></script>
<div id="log"></div>
<script>
test(function() {
elements.forEach(function(a) {
test(function() {
var e = document.createElement(a[0]), i = "HTML" + a[1] + "Element";
assert_class_string(e, i,
"Element " + a[0] + " should have " + i +
" as its primary interface.");
assert_true(e instanceof window[i],
"Element " + a[0] + " should implement " + i + ".");
assert_true(e instanceof HTMLElement,
"Element " + a[0] + " should implement HTMLElement.");
assert_true(e instanceof Element,
"Element " + a[0] + " should implement Element.");
assert_true(e instanceof Node,
"Element " + a[0] + " should implement Node.");
}, "Interfaces for " + a[0])
})
function do_test(local_name, iface) {
test(function() {
var e = document.createElement(local_name), i = "HTML" + iface + "Element";
assert_class_string(e, i,
"Element " + local_name + " should have " + i +
" as its primary interface.");
assert_true(e instanceof window[i],
"Element " + local_name + " should implement " + i + ".");
assert_true(e instanceof HTMLElement,
"Element " + local_name + " should implement HTMLElement.");
assert_true(e instanceof Element,
"Element " + local_name + " should implement Element.");
assert_true(e instanceof Node,
"Element " + local_name + " should implement Node.");
}, "Interfaces for " + local_name);
}

elements.forEach(function(a) {
do_test(a[0], a[1]);
})
</script>

0 comments on commit d9e8907

Please sign in to comment.