HTMLSummaryElement
概述
HTMLSummaryElement 是 Aspose.Html FOSS 中用于 Python 的类。继承自:HTMLElement。
表示一个 HTML <summary> 元素。
此类在 Python 程序中提供了 78 个用于操作 HTMLSummaryElement 对象的方法。可用的方法包括:__init__、add_event_listener、after、append、append_child、attach_shadow、before、blur、check_visibility、click、clone_node、closest,以及另外 66 个方法。安装 Aspose.Html FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:access_key、access_key_label、assigned_slot、attributes、autocapitalize、autofocus,以及另外 64 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
hidden | bool | 读写 | 元素是否隐藏(反映 hidden 布尔属性)。 |
title | str | 读写 | 此元素的工具提示标题(反映 title 属性)。 |
lang | str | 读写 | 元素内容的语言(反映 lang 属性)。 |
tab_index | int | 读写 | 此元素的制表顺序索引(反映 tabindex 属性)。 |
access_key | str | 读写 | 此元素的键盘快捷键(反映 accesskey |
attribute). || content_editable | str | 读/写 | 反映 contenteditable 属性(WHATWG HTML §6.6)。 | | is_content_editable | bool | 只读 | 此元素当前是否可编辑(WHATWG HTML §6.6)。 | | dir | str | 读/写 | 元素的文本方向(反映 dir 属性)。 | | draggable | bool | 读/写 | 元素是否可拖动(反映 draggable 属性)。 | | spell_check | bool | 读/写 | 是否启用拼写检查(反映 spellcheck 属性)。 | | spellcheck | bool | 读/写 | 是否启用拼写检查(反映 spellcheck 属性)。 | | autocapitalize | str | 读/写 | 自动大写提示(反映 autocapitalize 属性)。 | | nonce | str | 读/写 | CSP 的加密随机数(反映 nonce 属性)。 | | autofocus | bool | 读/写 | 此元素在页面加载时是否应获得焦点。 | | access_key_label | str | 只读 | 系统分配的访问键标签(无头存根:始终为 '')。 | | input_mode | str | 读/写 | 虚拟键盘输入模式提示(反映 inputmode 属性)。 | | enter_key_hint | str | 读/写 | Enter 键操作标签提示(反映 enterkeyhint 属性)。 | | translate | bool | 读/写 | 此元素是否启用翻译(WHATWG HTML §6.1.2)。 | | inner_text | str | 读/写 | 渲染的文本内容 — 空白折叠的 text_content。 | | outer_text | str | 读/写 | 同 inner_text(getter 根据 HTML 标准 §3.2.7 镜像 inner_text)。 | | popover | | Read/Write | Reflects thepopovercontent attribute (WHATWG HTML §6.12). | | node_name|str| Read | The qualified tag name (uppercase for HTML elements). | |tag_name|str| Read | The qualified tag name in uppercase (HTML elements). | |local_name|str| Read | The local part of the qualified name (lowercase). | |namespace_uri|str | None | Read | The namespace URI, orNonefor no namespace. | | style_sheets|“StyleSheetList”| Read | Live stylesheet list applicable to this element's document. | |prefix|str | None | Read | The namespace prefix, orNone. | | id|str| Read | The value of theidattribute, or’’if not present. | | class_name|str | Read | The value of theclassattribute, or’’. | | class_list|“DOMTokenList”| Read | Live mutable set of CSS class tokens backed by theclassattribute. | | dataset|“DOMStringMap” | Read | Live dict-like view of the element'sdata-*custom attributes. | | attributes|NamedNodeMap| Read | The ordered map of Attr objects for this element. | |children|HTMLCollection| Read | A live HTMLCollection of Element-type children only. | |first_element_child|Element | None | Read | The first Element child, orNone. | | last_element_child|Element | None| Read | The last Element child, orNone. | | next_element_sibling|Element | None| Read | The next sibling that is an Element, orNone. | | previous_element_sibling|Element | None| Read | The previous sibling that is an Element, orNone. | | child_element_count|int| Read | The number of Element children. | |inner_html|str| Read/Write | The serialised HTML content of all children (innerHTML). | |outer_html|str| Read/Write | The serialised HTML of this element and all its descendants (outerHTML). | |text_content|str | None| Read/Write | The concatenation of all descendant Text node data (DFS order). | |style|“CSSStyleDeclaration”| Read | The inline style of this element as a live CSSStyleDeclaration. | |scroll_width|int| Read | Content scroll width in CSS pixels (stub: 0). | |scroll_height|int| Read | Content scroll height in CSS pixels (stub: 0). | |client_width|int| Read | Inner width including padding, excluding border (stub: 0). | |client_height|int| Read | Inner height including padding, excluding border (stub: 0). | |scroll_top|int| Read/Write | Vertical scroll offset in CSS pixels (stub: 0). | |scroll_left|int| Read/Write | Horizontal scroll offset in CSS pixels (stub: 0). | |offset_width|int| Read | Layout border-box width in CSS pixels (stub: 0). | |offset_height|int| Read | Layout border-box height in CSS pixels (stub: 0). | |offset_top|int| Read | Top offset fromoffsetParentin CSS pixels (stub: 0). | | offset_left|int | Read | Left offset fromoffsetParentin CSS pixels (stub: 0). | | offset_parent|None | Read | The offset parent element; alwaysNonein headless mode. | | client_top|int | Read | Width of the top CSS border in pixels; always0in headless mode. | | client_left|int | Read | Width of the left CSS border in pixels; always0in headless mode. | | part|“DOMTokenList” | Read | Live DOMTokenList reflecting the elementpartattribute. | | shadow_root | | 只读 | 在无头模式下始终 None。 | | slot | str | 读/写 | 反映 slot 内容属性(DOM §4.2.3)。 | | assigned_slot | | Read | AlwaysNonein headless mode. | | node_type|int | Read | Integer node type constant fromNodeType. | | node_value|str | None| Read/Write | Character data for CharacterData nodes;Noneotherwise. | | parent_node|Node | None | Read | The parent node, orNoneif this node has no parent. | | parent_element|Element | None | Read | The parent node if it is an Element;Noneotherwise. | | is_connected|bool| Read | Whether this node is part of a document's node tree (WHATWG DOM §4.4). | |owner_document|Document | None | Read | The Document this node belongs to, orNonefor Document itself. | | child_nodes|NodeList| Read | A live NodeList of all child nodes. | |first_child|Node | None | Read | The first child node, orNone. | | last_child|Node | None| Read | The last child node, orNone. | | previous_sibling|Node | None| Read | The preceding sibling node, orNone. | | next_sibling|Node | None| Read | The following sibling node, orNone``. |
方法
| 签名 | 描述 |
|---|---|
click() | 在此元素上分派合成的 click 事件。 |
| `focus(options: “dict | None”)` |
blur() | 在此元素上分派非冒泡的 'blur' 事件。 |
show_popover() | 将此元素显示为弹出框(在无头模式下为无操作)。 |
hide_popover() | 隐藏此元素的弹出框(在无头模式下为无操作)。 |
| `toggle_popover(force: “bool | None”)→bool` |
| `init(local_name: str, namespace_uri: str | None, prefix: str |
get_computed_style() → "ComputedStyleDeclaration" | 返回此元素的第二阶段级联解析声明。 |
insert_adjacent_html(position: str, html: str) | 在此元素相对位置插入已解析的 HTML 标记。 |
insert_adjacent_text(position: str, text: str) | 在此元素相对位置插入文本节点。 |
| `insert_adjacent_element(position: str, element: “Element | None”)→“Element |
get_attribute(name: str) → `str | None` |
set_attribute(name: str, value: str) | 设置属性 name to value, 如果不存在则创建。 |
remove_attribute(name: str) | 移除属性 name. |
has_attribute(name: str) → bool | Return True 如果属性 name 存在于此元素上。 |
get_attribute_node(name: str) → `“Attr | None”` |
set_attribute_node(attr: "Attr") → `“Attr | None”` |
remove_attribute_node(attr: "Attr") → "Attr" | Remove attr 从此元素的属性集合中获取并返回它。 |
| `get_attribute_node_ns(namespace_uri: str | None, local_name: str)→“Attr |
set_attribute_node_ns(attr: "Attr") → `“Attr | None”` |
| `remove_attribute_node_ns(namespace_uri: str | None, local_name: str)→“Attr”` |
| `get_attribute_ns(namespace_uri: str | None, local_name: str)→str |
| `set_attribute_ns(namespace_uri: str | None, qualified_name: str, value: str)` |
| `has_attribute_ns(namespace_uri: str | None, local_name: str)→bool` |
| `remove_attribute_ns(namespace_uri: str | None, local_name: str)` |
| `toggle_attribute(name: str, force: bool | None)→bool` |
get_attribute_names() → list[str] | 按集合顺序返回所有属性的限定名称。 |
has_attributes() → bool | 当此元素具有一个或多个属性时,返回 True。 |
| `scroll_into_view(arg: bool | dict |
| `scroll(x_or_options: float | dict |
scroll_into_view_if_needed(center_if_needed: bool) | 如果此元素尚未可见,则将其滚动到视图中(在无头模式下为无操作)。 |
set_pointer_capture(pointer_id: int) | 将此元素指定为给定指针的捕获目标(无操作)。 |
release_pointer_capture(pointer_id: int) | 释放给定指针 ID 的指针捕获(无操作)。 |
has_pointer_capture(pointer_id: int) → bool | 返回此元素是否对给定 ID 拥有指针捕获。 |
request_pointer_lock() | 请求将指针锁定到此元素(无操作)。 |
| `request_fullscreen(options: “dict | None”)` |
| `check_visibility(options: “dict | None”)→bool` |
query_selector(selector: str) → `Element | None` |
query_selector_all(selector: str) → NodeList | 返回所有匹配元素的静态 NodeList selector. |
matches(selector: str) → bool | Return True 如果此元素匹配 CSS selector. |
webkit_matches_selector(selector: str) → bool | 浏览器兼容别名,指向 :meth:matches。 |
closest(selector: str) → `“Element | None”` |
get_elements_by_tag_name(qualified_name: str) → HTMLCollection | 返回所有标签名匹配的后代元素 qualified_name. |
get_elements_by_class_name(class_names: str) → HTMLCollection | 返回所有拥有给定全部类标记的后代元素。 |
filter_fn(el: "Element") → bool | 在此 HTMLSummaryElement 实例上调用 filter_fn(el)。 |
remove() | 将此元素从其父节点中移除。 |
before() | Insert nodes 在其父节点中紧靠此元素之前。 |
after() | Insert nodes 在其父节点中紧靠此元素之后。 |
replace_with() | 将此元素替换为 nodes 在其父元素中。 |
prepend() | Insert nodes 在此元素的第一个子元素之前。 |
append() | Append nodes 作为此元素的最后子元素。 |
replace_children() | 删除所有子节点,然后追加 nodes 作为新的子节点。 |
get_bounding_client_rect() → "DOMRect" | 返回边界客户端矩形(全零存根)。 |
get_client_rects() → "DOMRectList" | 返回客户端矩形列表(在服务器端上下文中为空)。 |
get_animations() → list[object] | 返回此元素的活动动画(无头存根:始终为 [])。 |
| `attach_shadow(init: “dict | None”)` |
get_root_node(composed: bool) → "Node" | 返回节点树的根节点。 |
has_child_nodes() → bool | 返回此节点是否至少有一个直接子节点。 |
| `lookup_namespace_uri(prefix: str | None)→str |
| `lookup_prefix(namespace_uri: str | None)→str |
| `is_default_namespace(namespace_uri: str | None)→bool` |
| `is_supported(feature: str, version: str | None)→bool` |
| `get_feature(feature: str, version: str | None)→object |
| `set_user_data(key: str, data: object | None, handler: object |
get_user_data(key: str) → `object | None` |
append_child(node: Node) → Node | Append node 作为此节点的最后一个子节点。 |
| `insert_before(node: Node, reference: Node | None)→Node` |
remove_child(node: Node) → Node | Remove node 从子列表中获取并返回它。 |
replace_child(new_child: Node, old_child: Node) → Node | Replace old_child with new_child. |
clone_node(deep: bool) → Node | 返回此节点的副本。 |
normalize() | 将此节点及其整个子树转换为规范形式。 |
| `contains(other: Node | None)→bool` |
compare_document_position(other: "Node") → int | 返回描述相对于此节点位置的位掩码 other 相对于此节点。 |
| `is_equal_node(other: Node | None)→bool` |
| `is_same_node(other_node: Node | None)→bool` |
add_event_listener(type: str, listener: Callable, capture: bool, once: bool) | Register listener 用于事件的 type. |
remove_event_listener(type: str, listener: Callable, capture: bool) | 注销先前已注册的监听器。 |
dispatch_event(event: "Event") → bool | Dispatch event 通过祖先树。 |