1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-16 18:20:51 +00:00

Add missing Element::get_elements_by_* methods

This commit is contained in:
Julien Cretin 2019-07-14 01:02:53 +02:00
parent a48a0aeb93
commit 170ce683d8
2 changed files with 25 additions and 2 deletions
crates/web-sys
tests/wasm
webidls/enabled

@ -196,4 +196,29 @@ fn element() {
request_fullscreen
request_pointer_lock
*/
let child = new_div();
assert_eq!(
element.get_elements_by_tag_name("div").length(),
0,
"Element should not contain any div child"
);
element.append_child(&child).unwrap();
assert_eq!(
element.get_elements_by_tag_name("div").length(),
1,
"Element should contain one div child"
);
assert_eq!(
element.get_elements_by_class_name("foo").length(),
0,
"Element should not have childs with class foo"
);
child.class_list().add_1("foo").unwrap();
assert_eq!(
element.get_elements_by_class_name("foo").length(),
1,
"Element should have one child with class foo"
);
element.remove_child(&child).unwrap();
}

@ -65,14 +65,12 @@ interface Element : Node {
[Throws, Pure, BinaryName="matches"]
boolean webkitMatchesSelector(DOMString selector);
/*TODO
[Pure]
HTMLCollection getElementsByTagName(DOMString localName);
[Throws, Pure]
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
[Pure]
HTMLCollection getElementsByClassName(DOMString classNames);
*/
[ChromeOnly, Pure]
sequence<Element> getElementsWithGrid();