mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 15:58:57 +00:00
element: upper case only the suffix part of the tagname
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
testing.expectEqual('http://www.w3.org/1999/xhtml', regularDiv.namespaceURI);
|
||||
|
||||
const custom = document.createElementNS('test', 'te:ST');
|
||||
testing.expectEqual('TE:ST', custom.tagName); // Should be te:ST
|
||||
testing.expectEqual('te:ST', custom.tagName);
|
||||
testing.expectEqual('te', custom.prefix);
|
||||
testing.expectEqual('ST', custom.localName);
|
||||
testing.expectEqual('http://www.w3.org/1999/xhtml', custom.namespaceURI); // Should be test
|
||||
|
||||
@@ -767,7 +767,15 @@ fn upperTagName(tag_name: *String, buf: []u8) []const u8 {
|
||||
log.info(.dom, "tag.long.name", .{ .name = tag_name.str() });
|
||||
return tag_name.str();
|
||||
}
|
||||
return std.ascii.upperString(buf, tag_name.str());
|
||||
const tag = tag_name.str();
|
||||
// If the tag_name has a prefix, we must uppercase only the suffix part.
|
||||
// example: te:st should be returned as te:ST.
|
||||
if (std.mem.indexOfPos(u8, tag, 0, ":")) |pos| {
|
||||
@memcpy(buf[0 .. pos + 1], tag[0 .. pos + 1]);
|
||||
_ = std.ascii.upperString(buf[pos..tag.len], tag[pos..tag.len]);
|
||||
return buf[0..tag.len];
|
||||
}
|
||||
return std.ascii.upperString(buf, tag);
|
||||
}
|
||||
|
||||
pub fn getTag(self: *const Element) Tag {
|
||||
|
||||
Reference in New Issue
Block a user