Add debug logging to register_named_element and unregister_named_element.

I found them helpful; I imagine others might as well.
This commit is contained in:
Ms2ger 2015-07-11 22:02:08 +02:00
parent 3d4122e7c1
commit da3c654f69

View file

@ -396,6 +396,7 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
fn unregister_named_element(self,
to_unregister: &Element,
id: Atom) {
debug!("Removing named element from document {:p}: {:p} id={}", self, to_unregister, id);
let mut idmap = self.idmap.borrow_mut();
let is_empty = match idmap.get_mut(&id) {
None => false,
@ -417,6 +418,7 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
fn register_named_element(self,
element: &Element,
id: Atom) {
debug!("Adding named element to document {:p}: {:p} id={}", self, element, id);
assert!({
let node = NodeCast::from_ref(element);
node.is_in_doc()