StackOfOpenElements
StackOfOpenElements
概述
StackOfOpenElements 是 Aspose.Html FOSS 中用于 Python 的类。
根据 §13.2.4.2 定义的打开元素堆栈。
此类提供 12 个方法,用于在 Python 程序中处理 StackOfOpenElements 对象。可用的方法包括:__init__、contains_node、has_in_button_scope、has_in_list_item_scope、has_in_scope、has_in_select_scope、has_in_table_scope、index_of、pop、pop_until、pop_until_node、push。在安装 Aspose.Html FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:bottom、current。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
current | `Element | None` | 读取 |
bottom | `Element | None` | 读取 |
方法
| 签名 | 描述 |
|---|---|
__init__() | Calls init 在此 StackOfOpenElements 实例上。 |
push(element: Element) | 将元素压入栈顶。 |
pop() → Element | 弹出并返回当前(栈顶)元素。 |
pop_until() | 弹出元素,直到弹出具有 tag_names 之一的元素。 |
pop_until_node(node: Element) | 弹出元素,直到节点被弹出。 |
contains_node(node: Element) → bool | 如果精确的节点对象在栈上,则为 True。 |
has_in_scope(tag_name: str) → bool | §13.2.4.2 — 在作用域中有元素。 |
has_in_button_scope(tag_name: str) → bool | §13.2.4.2 — 在按钮作用域中有元素。 |
has_in_list_item_scope(tag_name: str) → bool | §13.2.4.2 — 在列表项作用域中有元素。 |
has_in_table_scope(tag_name: str) → bool | §13.2.4.2 — 在表格作用域中有元素。 |
has_in_select_scope(tag_name: str) → bool | §13.2.4.2 — 在 select 作用域中有元素。 |
index_of(element: Element) → int | 返回从底部算起的 0 基索引,如果未找到则返回 -1。 |