mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 00:08:59 +00:00
css: ensure node is an element before accessing to attr
This commit is contained in:
@@ -74,6 +74,7 @@ pub const Node = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn attr(n: Node, key: []const u8) !?[]const u8 {
|
pub fn attr(n: Node, key: []const u8) !?[]const u8 {
|
||||||
|
if (!n.isElement()) return null;
|
||||||
return try parser.elementGetAttribute(parser.nodeToElement(n.node), key);
|
return try parser.elementGetAttribute(parser.nodeToElement(n.node), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user