mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
node: add lookupPrefix method (NOT TESTED)
Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
@@ -175,6 +175,11 @@ pub const Node = struct {
|
|||||||
return parser.nodeIsSameNode(self, other);
|
return parser.nodeIsSameNode(self, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn _lookupPrefix(self: *parser.Node, namespace: ?[]const u8) ?[]const u8 {
|
||||||
|
// TODO: other is not an optional parameter, but can be null.
|
||||||
|
return parser.nodeLookupPrefix(self, namespace);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn _normalize(self: *parser.Node) void {
|
pub fn _normalize(self: *parser.Node) void {
|
||||||
return parser.nodeNormalize(self);
|
return parser.nodeNormalize(self);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,6 +383,21 @@ pub fn nodeIsSameNode(node: *Node, other: *Node) bool {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nodeLookupPrefix(node: *Node, namespace: ?[]const u8) ?[]const u8 {
|
||||||
|
if (namespace == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (std.mem.eql(u8, namespace.?, "")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var s: ?*String = undefined;
|
||||||
|
_ = nodeVtable(node).dom_node_lookup_prefix.?(node, stringFromData(namespace.?), &s);
|
||||||
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return stringToData(s.?);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn nodeNormalize(node: *Node) void {
|
pub fn nodeNormalize(node: *Node) void {
|
||||||
_ = nodeVtable(node).dom_node_normalize.?(node);
|
_ = nodeVtable(node).dom_node_normalize.?(node);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user