mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
Merge pull request #5 from francisbouvier/fix-undef-tag
Fix workaround for tag undef not 0 in lxb_dom_node_tag_id
This commit is contained in:
@@ -180,7 +180,15 @@ pub inline fn nodeEventTarget(node: *Node) *EventTarget {
|
||||
}
|
||||
|
||||
pub inline fn nodeTag(node: *Node) Tag {
|
||||
return @intToEnum(Tag, c.lxb_dom_node_tag_id(node));
|
||||
// FIXME: lxb_dom_node_tag_id returns a big number if element is unknwon
|
||||
// while it should return 0 (value of enum LXB_TAG__UNDEF).
|
||||
// This fix the problem by assuming that a value greater than an u8 (the basis
|
||||
// of Tag enum) is 0.
|
||||
var val = c.lxb_dom_node_tag_id(node);
|
||||
if (val > 256) {
|
||||
val = 0;
|
||||
}
|
||||
return @intToEnum(Tag, val);
|
||||
}
|
||||
|
||||
pub const nodeWalker = (fn (node: ?*Node, _: ?*anyopaque) callconv(.C) Action);
|
||||
|
||||
Reference in New Issue
Block a user