mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Generate node names for CSS selection
This commit is contained in:
parent
5fd318be80
commit
d8a8a4bc3f
2 changed files with 17 additions and 3 deletions
|
@ -1 +1 @@
|
|||
Subproject commit e3d3a5d65ded9afc69a9033a5a8e609a88527476
|
||||
Subproject commit a52c721657cf6ea7b76ddbd4787bf8590978c365
|
|
@ -1,10 +1,24 @@
|
|||
use dom::node::Node;
|
||||
use dom::node::{Node, Doctype, Comment, Element, Text};
|
||||
use newcss::SelectHandler;
|
||||
|
||||
pub struct NodeSelectHandler {
|
||||
node: Node
|
||||
}
|
||||
|
||||
impl NodeSelectHandler: SelectHandler<Node> {
|
||||
|
||||
/// Placeholder names
|
||||
fn unnamed_node(name: &str) -> ~str {
|
||||
fmt!("unnamed-%s", name)
|
||||
}
|
||||
|
||||
impl NodeSelectHandler: SelectHandler<Node> {
|
||||
fn node_name(node: &Node) -> ~str {
|
||||
do node.read |data| {
|
||||
match *data.kind {
|
||||
Doctype(*) => unnamed_node("doctype"),
|
||||
Comment(*) => unnamed_node("comment"),
|
||||
Element(ref data) => copy data.tag_name,
|
||||
Text(*) => unnamed_node("text")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue