Commit Graph

45 Commits

Author SHA1 Message Date
Francis Bouvier
5734b903ec Adapt HTMLCollectionIterator to HTMLCollection._item changes
And update jsruntime to fix the build

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-01-13 15:14:43 +01:00
Pierre Tachoire
0b17d79baa dom: add HTMLCollectionIterator 2023-11-20 10:50:20 +01:00
Pierre Tachoire
c1b4026fa3 Merge pull request #144 from lightpanda-io/html-doc
dom: DocumentHTML getters
2024-01-10 17:33:43 +01:00
Francis Bouvier
a5dfa6cb44 Adopt global Types changes in jsruntime
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-01-10 11:56:53 +01:00
Pierre Tachoire
c73ecb5e0d HTMLDocument: implement all getter 2024-01-09 14:13:51 +01:00
Pierre Tachoire
91d1f539d4 HTMLDocument: implements anchors 2024-01-09 14:13:51 +01:00
Pierre Tachoire
584b254c08 HTMLDocument: applets return empty collection 2024-01-09 14:13:50 +01:00
Pierre Tachoire
db8031f965 HTMLCollection: add match by links 2024-01-09 14:13:48 +01:00
Pierre Tachoire
0b952f5295 HTMLCollection: add a matcher by name 2024-01-09 14:13:47 +01:00
Pierre Tachoire
bedac0a2c5 html_collection: explicitely list switch cases 2023-12-15 13:55:04 +01:00
Pierre Tachoire
314d2dae80 typo fix
Co-authored-by: Francis Bouvier <francis@lightpanda.io>
2023-12-15 13:54:52 +01:00
Pierre Tachoire
510dd8bf9d dom: imprive children walker 2023-12-13 16:23:45 +01:00
Pierre Tachoire
82c836c80d dom: document first element can be null 2023-12-13 13:12:01 +01:00
Pierre Tachoire
fb2ba6700e dom: add element children and getelementsby* 2023-12-13 11:10:48 +01:00
Pierre Tachoire
6f91537354 dom: add document.children 2023-12-13 11:10:48 +01:00
Pierre Tachoire
6566df6338 dom: refacto html collection to handle root or descendant only
HTMLCollection works on two different way:
* by default it must walk over root's descendants only
* on document, since the given root must be included in the walk.
2023-12-13 11:10:44 +01:00
Francis Bouvier
a6a18cf0f5 Merge pull request #96 from Browsercore/dom_error
Check DOMError
2023-11-30 17:15:04 +01:00
Francis Bouvier
b53c160001 HTMLCollection: add unit test for liveness
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2023-11-29 17:35:37 +01:00
Francis Bouvier
2065d47d8e Check DOMError
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2023-11-28 17:55:49 +01:00
Francis Bouvier
71866001db 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>
2023-11-26 23:49:21 +01:00
Pierre Tachoire
2ce6f36006 dom: html_collection: rename Match into Matcher 2023-11-20 14:57:43 +01:00
Pierre Tachoire
1d5eb47732 dom: html_collection: remove useless error union 2023-11-20 14:57:43 +01:00
Pierre Tachoire
9acf3fb209 dom: remove useless deinit from html_collection 2023-11-20 14:57:42 +01:00
Pierre Tachoire
dd28204797 dom: implement getElementsByClassName 2023-11-20 14:57:42 +01:00
Pierre Tachoire
e9edb8bab4 dom: no need to allocate mem for case insensitive equality
thanks to
[std.ascii.eqlIgnoreCase](https://ziglang.org/documentation/master/std/#A;std:ascii.eqlIgnoreCase)
2023-11-20 14:57:41 +01:00
Pierre Tachoire
9b94a4ec49 dom: deinit matcher with HTMLCollection 2023-11-20 14:57:41 +01:00
Pierre Tachoire
78e2f70cfb dom: refacto HTMLCollection to extract matching 2023-11-20 14:57:41 +01:00
Pierre Tachoire
3ca6a4a74e dom: fix bug in collection get_next 2023-11-16 17:32:31 +01:00
Pierre Tachoire
9b923c550b dom: remove unreachable from html collection 2023-11-16 17:32:30 +01:00
Pierre Tachoire
3909fc01a7 dom: improve code style 2023-11-16 17:32:30 +01:00
Pierre Tachoire
a136e812ae dom: add collection get_next comment 2023-11-16 17:32:30 +01:00
Pierre Tachoire
2129361fa0 dom: is_wildcard is never changed 2023-11-16 17:32:29 +01:00
Pierre Tachoire
ba32e1baff dom: collection: use nullable value instead fo undefined 2023-11-16 12:31:26 +01:00
Pierre Tachoire
24d3854138 dom: saner returns for html collection 2023-11-15 17:06:42 +01:00
Pierre Tachoire
f02769b2dd dom: use allocator with HTMLCollection getters 2023-11-15 16:09:09 +01:00
Pierre Tachoire
9bb200a46f dom: rename HTMLCollection._next() into get_next()
We don't want expose the function to the JS API.
2023-11-15 16:09:08 +01:00
Pierre Tachoire
84934cca13 dom: add HTMLCollection unit tests 2023-11-15 16:09:06 +01:00
Pierre Tachoire
055bde96e4 dom: speedup HTMLCollection.item() w/ an internal state 2023-11-15 16:09:04 +01:00
Pierre Tachoire
5f05cffff9 dom: remove optional node type 2023-11-15 16:09:03 +01:00
Pierre Tachoire
8c1d1e491c dom: refacto HTMLCollection next 2023-11-15 16:09:01 +01:00
Pierre Tachoire
1fe49adba2 dom: add comment about buffer with fixed length
The buffer is used for upper case string transformation.
2023-11-15 16:09:00 +01:00
Pierre Tachoire
09d032f6f8 dom: implement HTMLCollection.namedItem() 2023-11-15 16:08:58 +01:00
Pierre Tachoire
3a188c4568 dom: compare tagname in case insensitive way 2023-11-15 16:08:57 +01:00
Pierre Tachoire
062a1a4010 dom: implement HTMLCollection
We can't simply use the libdom dom_document_get_elements_by_tag_name
because it follows an old version of the specifications and returns a
NodeList.
Since
190700b7c1
the spec changed in favor of returning an HTMLCollection.

So I'm trying to re-implement the HTMLCollection in zig.
2023-11-15 16:08:55 +01:00
Pierre Tachoire
2e40837f0d dom: add HTMLCollection 2023-11-15 16:08:52 +01:00