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_namestrอ่าน'#document-fragment'
text_content`strNone`อ่าน/เขียน
node_typeintอ่านค่าคงที่ประเภทโหนดจำนวนเต็มจาก NodeType.
node_value`strNone`อ่าน/เขียน
parent_node`NodeNone`อ่าน
parent_element`ElementNone`อ่าน
is_connectedboolอ่านว่าโหนดนี้เป็นส่วนหนึ่งของต้นไม้โหนดของเอกสารหรือไม่ (WHATWG DOM §4.4).
owner_document`DocumentNone`อ่าน
child_nodesNodeListอ่านรายการ NodeList สดของโหนดลูกทั้งหมด.
first_child`NodeNone`อ่าน
last_child`NodeNone`อ่าน
previous_sibling`NodeNone`อ่าน
next_sibling`NodeNone`อ่าน

วิธีการ

ลายเซ็นคำอธิบาย
`init(owner_document: DocumentNone)`
prepend()Insert nodes ก่อนลูกแรกของ fragment นี้.
append()Append nodes เป็นลูกสุดท้ายของ fragment นี้.
replace_children()ลบ children ทั้งหมดของ fragment นี้ แล้ว append nodes.
query_selector(selector: str) → `“ElementNone”`
query_selector_all(selector: str) → "NodeList"คืนค่า NodeList แบบคงที่ของทุกองค์ประกอบในส่วน fragment นี้ที่ตรงกับ selector.
get_root_node(composed: bool) → "Node"คืนค่ารากของต้นไม้ของโหนด.
has_child_nodes() → boolคืนค่าว่าโหนดนี้มีโหนดลูกโดยตรงอย่างน้อยหนึ่งโหนดหรือไม่.
`lookup_namespace_uri(prefix: strNone)→str
`lookup_prefix(namespace_uri: strNone)→str
`is_default_namespace(namespace_uri: strNone)→bool`
`is_supported(feature: str, version: strNone)→bool`
`get_feature(feature: str, version: strNone)→object
`set_user_data(key: str, data: objectNone, handler: object
get_user_data(key: str) → `objectNone`
append_child(node: Node) → NodeAppend node เป็นลูกสุดท้ายของโหนดนี้.
`insert_before(node: Node, reference: NodeNone)→Node`
remove_child(node: Node) → NodeRemove node จากรายการลูกและคืนค่า.
replace_child(new_child: Node, old_child: Node) → NodeReplace old_child with new_child.
clone_node(deep: bool) → Nodeคืนสำเนาของโหนดนี้.
normalize()ใส่โหนดนี้และต้นไม้ย่อยทั้งหมดของมันให้อยู่ในรูปแบบที่ทำให้เป็นมาตรฐาน.
`contains(other: NodeNone)→bool`
compare_document_position(other: "Node") → intคืนค่า bitmask ที่อธิบายตำแหน่งของ other สัมพันธ์กับโหนดนี้.
`is_equal_node(other: NodeNone)→bool`
`is_same_node(other_node: NodeNone)→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") → boolDispatch event ผ่านต้นไม้บรรพบุรุษ.

ดูเพิ่มเติม

 ภาษาไทย