mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Basic Implementation of document.getElementById(), #740
This commit is contained in:
parent
f9be872e61
commit
db3b5c3c4c
4 changed files with 126 additions and 4 deletions
|
@ -473,6 +473,16 @@ impl Node<ScriptView> {
|
|||
cur_node = cur_node.unwrap().next_sibling();
|
||||
}
|
||||
|
||||
// Unregister elements having "id' from the old doc.
|
||||
do old_doc.with_mut_base |old_doc| {
|
||||
old_doc.unregister_nodes_with_id(&abstract_self);
|
||||
}
|
||||
|
||||
// Register elements having "id" attribute to the owner doc.
|
||||
do doc.with_mut_base |doc| {
|
||||
doc.register_nodes_with_id(&abstract_self);
|
||||
}
|
||||
|
||||
// Signal the old document that it needs to update its display
|
||||
if old_doc != doc {
|
||||
do old_doc.with_base |old_doc| {
|
||||
|
@ -779,6 +789,12 @@ impl Node<ScriptView> {
|
|||
|
||||
self.wait_until_safe_to_modify_dom();
|
||||
|
||||
// Unregister elements having "id' from the owner doc.
|
||||
// This need be called before target nodes are removed from tree.
|
||||
do self.owner_doc.with_mut_base |doc| {
|
||||
doc.unregister_nodes_with_id(&abstract_self);
|
||||
}
|
||||
|
||||
abstract_self.remove_child(node);
|
||||
// Signal the document that it needs to update its display.
|
||||
do self.owner_doc.with_base |document| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue