fix(dom): enumerate collection query methods

This commit is contained in:
ldm0
2026-10-22 21:28:20 +08:00
committed by Donough Liu
parent d31b51af4c
commit 644b82c710
6 changed files with 7 additions and 7 deletions
@@ -97,7 +97,7 @@ struct NodeListPrototypeMembersDeclaration {
#[webapi(accessor_property, enumerable, getter = node_list_length_getter)]
length: (),
#[webapi(method, length = 1, callback = node_list_item_callback)]
#[webapi(method, length = 1, enumerable, callback = node_list_item_callback)]
item: (),
#[webapi(
@@ -448,7 +448,7 @@ struct DocumentCollectionAccessorsPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
#[webapi(interface = web_api_interfaces::Document, receiver)]
#[webapi(interface = web_api_interfaces::Document, enumerable, receiver)]
struct DocumentCollectionQueryPrototypeDeclaration {
#[webapi(
method,
@@ -1372,7 +1372,7 @@ pub(crate) fn install_document_template_bindings<'s>(
}
#[derive(WebApiFunctionTemplate)]
#[webapi(interface = web_api_interfaces::Document, receiver)]
#[webapi(interface = web_api_interfaces::Document, enumerable, receiver)]
struct DocumentGetElementByIdTemplateDeclaration {
#[webapi(method = "getElementById", length = 1, callback = node_get_element_by_id_callback)]
get_element_by_id: (),
@@ -982,7 +982,7 @@ fn document_template_methods_keep_declared_reflection_shape() {
r#"
(() => {
const methods = [
["getElementById", 1, false],
["getElementById", 1],
["createElement", 1],
["createAttribute", 1],
["createAttributeNS", 2],
@@ -602,7 +602,7 @@ fn element_methods_and_dataset_live_on_owner_prototypes() {
fragmentChild.setAttribute("name", "fragment-name");
fragmentChild.id = "fragment-id";
fragment.appendChild(fragmentChild);
method(Document.prototype, "getElementById", 1, false);
method(Document.prototype, "getElementById", 1, true);
method(DocumentFragment.prototype, "getElementById", 1, false);
assert(!own(document, "getElementById"), "getElementById should not be own on document");
assert(!own(fragment, "getElementById"), "getElementById should not be own on fragment");
@@ -327,7 +327,7 @@ fn dom_parser_native_query_selector_all_declares_node_list_shell() {
assert_eq!(
result,
"[object NodeList]|NodeList|true|2|a|b|true|a|b|true|a,b|false|false|false|true:false:true:true:function:item:1|true:false:true:true:function|true|false|true|a|a,b"
"[object NodeList]|NodeList|true|2|a|b|true|a|b|true|a,b|false|false|false|true:true:true:true:function:item:1|true:false:true:true:function|true|false|true|a|a,b"
);
}
@@ -5886,7 +5886,7 @@ fn collection_webidl_members_live_on_interface_prototypes() {
assert_eq!(
result,
r#"{"own":{"htmlLength":false,"nodeLength":false,"optionsLength":false,"optionsSelectedIndex":false,"optionsAdd":false,"radioValue":false},"chains":[true,true],"accessors":{"htmlLength":"get length:0:::true:true","nodeLength":"get length:0:::true:true","optionsLength":"get length:0:set length:1:true:true","selectedIndex":"get selectedIndex:0:set selectedIndex:1:true:true","radioValue":"get value:0:set value:1:true:true"},"methods":{"htmlItem":"item:1:true:true:true","namedItem":"namedItem:1:true:true:true","nodeItem":"item:1:false:true:true","add":"add:1:true:true:true","remove":"remove:1:true:true:true"},"borrowed":[2,1,"second",false,true],"forged":["TypeError","TypeError","TypeError"],"crossBrand":["TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError"],"tags":["[object HTMLOptionsCollection]","[object RadioNodeList]"]}"#
r#"{"own":{"htmlLength":false,"nodeLength":false,"optionsLength":false,"optionsSelectedIndex":false,"optionsAdd":false,"radioValue":false},"chains":[true,true],"accessors":{"htmlLength":"get length:0:::true:true","nodeLength":"get length:0:::true:true","optionsLength":"get length:0:set length:1:true:true","selectedIndex":"get selectedIndex:0:set selectedIndex:1:true:true","radioValue":"get value:0:set value:1:true:true"},"methods":{"htmlItem":"item:1:true:true:true","namedItem":"namedItem:1:true:true:true","nodeItem":"item:1:true:true:true","add":"add:1:true:true:true","remove":"remove:1:true:true:true"},"borrowed":[2,1,"second",false,true],"forged":["TypeError","TypeError","TypeError"],"crossBrand":["TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError"],"tags":["[object HTMLOptionsCollection]","[object RadioNodeList]"]}"#
);
}