Add a with_imm_element_like() method.

… gives a generic element from a generic node.
This commit is contained in:
Simon Sapin 2013-10-16 18:44:41 +01:00
parent 62f1f03c16
commit 6c41be9c13
3 changed files with 19 additions and 7 deletions

View file

@ -120,12 +120,12 @@ pub enum ElementTypeId {
// Element methods
//
impl<'self> ElementLike<'self> for Element {
fn get_local_name(&'self self) -> &'self str {
impl ElementLike for Element {
fn get_local_name<'a>(&'a self) -> &'a str {
self.tag_name.as_slice()
}
fn get_attr(&'self self, name: &str) -> Option<&'self str> {
fn get_attr<'a>(&'a self, name: &str) -> Option<&'a str> {
// FIXME: Need an each() that links lifetimes in Rust.
for attr in self.attrs.iter() {
// FIXME: only case-insensitive in the HTML namespace (as opposed to SVG, etc.)