DocumentFragment
DocumentFragment
סקירה כללית
DocumentFragment היא מחלקה ב-Aspose.Html FOSS עבור Python. יורשת מ: Node.
מכולה קלת משקל עבור תת-עץ.
מחלקה זו מספקת 28 שיטות לעבודה עם עצמים DocumentFragment בתוכניות Python. השיטות הזמינות כוללות: __init__, add_event_listener, append, append_child, clone_node, compare_document_position, contains, dispatch_event, get_feature, get_root_node, get_user_data, has_child_nodes, ו-16 שיטות נוספות. כל החברים הציבוריים נגישים לכל יישום Python לאחר התקנת חבילת Aspose.Html FOSS עבור Python. מאפיינים: child_nodes, first_child, is_connected, last_child, next_sibling, node_name, ו-7 נוספים.
מאפיינים
| שם | סוג | גישה | תיאור |
|---|---|---|---|
node_name | str | קריאה | '#document-fragment' |
text_content | `str | None` | קריאה/כתיבה |
node_type | int | קריאה | קבוע סוג צומת של מספר שלם מ-NodeType. |
node_value | `str | None` | קריאה/כתיבה |
parent_node | `Node | None` | קריאה |
parent_element | `Element | None` | קריאה |
is_connected | bool | קריאה | האם צומת זה הוא חלק מעץ הצמתים של מסמך (WHATWG DOM §4.4). |
owner_document | `Document | None` | קריאה |
child_nodes | NodeList | קריאה | NodeList חי של כל הצמתים הבנים. |
first_child | `Node | None` | קריאה |
last_child | `Node | None` | קריאה |
previous_sibling | `Node | None` | קריאה |
next_sibling | `Node | None` | קריאה |
שיטות
| חתימה | תיאור |
|---|---|
| `init(owner_document: Document | None)` |
prepend() | Insert nodes לפני הילד הראשון של הקטע הזה. |
append() | Append nodes כאחרונים של הקטע הזה. |
replace_children() | הסר את כל הילדים של הקטע הזה, ואז הוסף nodes. |
query_selector(selector: str) → `“Element | None”` |
query_selector_all(selector: str) → "NodeList" | החזר NodeList סטטי של כל האלמנטים בקטע הזה התואמים selector. |
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 דרך עץ האבות. |