mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-29 15:13:28 +00:00 
			
		
		
		
	Adapt to free js slices
Relates to PR https://github.com/Browsercore/jsruntime-lib/issues/111 Relates to issue https://github.com/Browsercore/jsruntime-lib/pull/142 Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
		| @@ -97,15 +97,33 @@ pub const Document = struct { | ||||
|     // the spec changed to return an HTMLCollection instead. | ||||
|     // That's why we reimplemented getElementsByTagName by using an | ||||
|     // HTMLCollection in zig here. | ||||
|     pub fn _getElementsByTagName(self: *parser.Document, tag_name: []const u8) collection.HTMLCollection { | ||||
|     pub fn _getElementsByTagName( | ||||
|         self: *parser.Document, | ||||
|         alloc: std.mem.Allocator, | ||||
|         tag_name: []const u8, | ||||
|     ) !collection.HTMLCollection { | ||||
|         const root = parser.documentGetDocumentElement(self); | ||||
|         return collection.HTMLCollectionByTagName(parser.elementToNode(root), tag_name); | ||||
|         return try collection.HTMLCollectionByTagName( | ||||
|             alloc, | ||||
|             parser.elementToNode(root), | ||||
|             tag_name, | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     pub fn _getElementsByClassName(self: *parser.Document, classNames: []const u8) collection.HTMLCollection { | ||||
|     pub fn _getElementsByClassName( | ||||
|         self: *parser.Document, | ||||
|         alloc: std.mem.Allocator, | ||||
|         classNames: []const u8, | ||||
|     ) !collection.HTMLCollection { | ||||
|         const root = parser.documentGetDocumentElement(self); | ||||
|         return collection.HTMLCollectionByClassName(parser.elementToNode(root), classNames); | ||||
|         return try collection.HTMLCollectionByClassName( | ||||
|             alloc, | ||||
|             parser.elementToNode(root), | ||||
|             classNames, | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     pub fn deinit(_: *parser.Document, _: std.mem.Allocator) void {} | ||||
| }; | ||||
|  | ||||
| // Tests | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Francis Bouvier
					Francis Bouvier