mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-19 02:18:10 +00:00
css: add nth- pseudo class
This commit is contained in:
@@ -13,6 +13,13 @@ pub const Node = struct {
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn lastChild(n: Node) !?Node {
|
||||
const c = try parser.nodeLastChild(n.node);
|
||||
if (c) |cc| return .{ .node = cc };
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn nextSibling(n: Node) !?Node {
|
||||
const c = try parser.nodeNextSibling(n.node);
|
||||
if (c) |cc| return .{ .node = cc };
|
||||
@@ -20,6 +27,13 @@ pub const Node = struct {
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn prevSibling(n: Node) !?Node {
|
||||
const c = try parser.nodePreviousSibling(n.node);
|
||||
if (c) |cc| return .{ .node = cc };
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn parent(n: Node) !?Node {
|
||||
const c = try parser.nodeParentNode(n.node);
|
||||
if (c) |cc| return .{ .node = cc };
|
||||
@@ -39,4 +53,8 @@ pub const Node = struct {
|
||||
pub fn attr(n: Node, key: []const u8) !?[]const u8 {
|
||||
return try parser.elementGetAttribute(parser.nodeToElement(n.node), key);
|
||||
}
|
||||
|
||||
pub fn eql(a: Node, b: Node) bool {
|
||||
return a.node == b.node;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user