Skip to content

Commit

Permalink
Add Element::get_elements_by_class_name
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Jul 13, 2019
1 parent 13b672a commit c1d15d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions crates/web-sys/tests/wasm/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,18 @@ fn element() {
request_fullscreen
request_pointer_lock
*/

let child = new_div();
element.append_child(&child).unwrap();
assert_eq!(
element.get_elements_by_class_name("foo").length(),
0,
"Should not have matching elements"
);
child.class_list().add_1("foo").unwrap();
assert_eq!(
element.get_elements_by_class_name("foo").length(),
1,
"Should match the only child"
);
}
2 changes: 1 addition & 1 deletion crates/web-sys/webidls/enabled/Element.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ interface Element : Node {
HTMLCollection getElementsByTagName(DOMString localName);
[Throws, Pure]
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
*/
[Pure]
HTMLCollection getElementsByClassName(DOMString classNames);
*/
[ChromeOnly, Pure]
sequence<Element> getElementsWithGrid();

Expand Down

0 comments on commit c1d15d1

Please sign in to comment.