Repository: servo/servo
File: components/script/dom/element.rs (Rust)

Code before:
                        },
                    }
                }
            },
            &local_name!("slot") => {
                // Update slottable data
                let cx = GlobalScope::get_cx();

                rooted!(in(*cx) let slottable = Slottable(Dom::from_ref(self.upcast::<Node>())));

                // Slottable name change steps from https://dom.spec.whatwg.org/#light-tree-slotables
                if let Some(assigned_slot) = slottable.assigned_slot() {
                    assigned_slot.assign_slottables();
                }
                slottable.assign_a_slot();
            },
            _ => {
                // FIXME(emilio): This is pretty dubious, and should be done in
                // the relevant super-classes.
                if attr.namespace() == &ns!() && attr.local_name() == &local_name!("src") {
                    node.dirty(NodeDamage::Other);
                }
            },
        };

        // TODO: This should really only take into account the actual attribute that are used
        // for the content attribute property.
        if self
            .upcast::<Node>()
            .get_flag(NodeFlags::USES_ATTR_IN_CONTENT_ATTRIBUTE)
        {
            node.dirty(NodeDamage::ContentOrHeritage);
        }

        // Make sure we rev the version even if we didn't dirty the node. If we
        // don't do this, various attribute-dependent htmlcollections (like those
        // generated by getElementsByClassName) might become stale.
        node.rev_version();
    }

    fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
        match *name {
            local_name!("id") => AttrValue::Atom(value.into()),
            local_name!("name") => AttrValue::Atom(value.into()),
            local_name!("class") | local_name!("part") => {
                AttrValue::from_serialized_tokenlist(value.into())
            },
            local_name!("exportparts") => AttrValue::from_shadow_parts(value.into()),
            _ => self
                .super_type()
                .unwrap()

Review comment (suggestion):
```suggestion
        // TODO: This should really only take into account the actual attributes that are used
```

Code after:
                        },
                    }
                }
            },
            &local_name!("slot") => {
                // Update slottable data
                let cx = GlobalScope::get_cx();

                rooted!(in(*cx) let slottable = Slottable(Dom::from_ref(self.upcast::<Node>())));

                // Slottable name change steps from https://dom.spec.whatwg.org/#light-tree-slotables
                if let Some(assigned_slot) = slottable.assigned_slot() {
                    assigned_slot.assign_slottables();
                }
                slottable.assign_a_slot();
            },
            _ => {
                // FIXME(emilio): This is pretty dubious, and should be done in
                // the relevant super-classes.
                if attr.namespace() == &ns!() && attr.local_name() == &local_name!("src") {
                    node.dirty(NodeDamage::Other);
                }
            },
        };

        // TODO: This should really only take into account the actual attributes that are used
        // for the content attribute property.
        if self
            .upcast::<Node>()
            .get_flag(NodeFlags::USES_ATTR_IN_CONTENT_ATTRIBUTE)
        {
            node.dirty(NodeDamage::ContentOrHeritage);
        }

        // Make sure we rev the version even if we didn't dirty the node. If we
        // don't do this, various attribute-dependent htmlcollections (like those
        // generated by getElementsByClassName) might become stale.
        node.rev_version();
    }

    fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
        match *name {
            local_name!("id") => AttrValue::Atom(value.into()),
            local_name!("name") => AttrValue::Atom(value.into()),
            local_name!("class") | local_name!("part") => {
                AttrValue::from_serialized_tokenlist(value.into())
            },
            local_name!("exportparts") => AttrValue::from_shadow_parts(value.into()),
            _ => self
                .super_type()
                .unwrap()