Skip to content

Conversation

@sjorsdonkers
Copy link
Contributor

@sjorsdonkers sjorsdonkers commented May 28, 2025

Depends on: lightpanda-io/libdom#28

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
Properties that are implemented by Netsurf, not deprecated, and not inherited from HTMLElement.

With these we probable have enough examples to make a generic implementation, for that note that there are some special cases:

  • Some netsurf properties are deprecated
  • Netsurf does not support all properties
  • Some properties are inherited through the prototype chain
  • Some properties have default values if the netsurf says null or the unsigned version of -1
  • The initial value and the default value do not need to be the same. init -1 default 0 for example.
  • The set and get types may be different get may return -1 i32, but set must be positive u32
  • Some specific values instead of defaulting throw an error.
  • Sometimes the Set functions is not implemented bynetsurf even if the property is not readonly
  • The default initialization and reverting to default on bad value assignment also needs to work for Element.setAttribute and Element.getAttribute
  • Values may related default value properties used until the value itself is set.
  • src properties need to be stiched with the pages url.
  • Netsurf may create more DOM events than defined by the spec upon setting a property without using setAttribute. TBD

PR created to make Playwright page.getByRole work.

@karlseguin
Copy link
Collaborator

No tests (should have), but this case wrongly fails:

.{ "document.createElement('input').type", "text" }

Assuming it would also fail with the HTML <input>, then it's realistically important enough to fix I think.

Any other wrong defaults should at least be documented, but probably also fixed.

@sjorsdonkers sjorsdonkers marked this pull request as draft May 30, 2025 08:39
try testing.expectError(error.ExecutionError, runner.testCases(&.{.{ "elem_input.size = 0", null }}, .{}));
try testing.expectError(error.ExecutionError, runner.testCases(&.{.{ "elem_input.size = 'banana'", null }}, .{}));
try testProperty(&runner, "input", "src", "", "", &.{
.{ .input = "foo", .is_str = true, .expected = "https://lightpanda.io/foo" }, // TODO stitch should work with spaces -> %20
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mookums stitch should probably work with spaces -> %20 and such

@sjorsdonkers sjorsdonkers force-pushed the HTMLInputElement-properties branch from 0e0f577 to 0c0f7b4 Compare June 2, 2025 06:42
@sjorsdonkers sjorsdonkers force-pushed the HTMLInputElement-properties branch from 0c0f7b4 to 19d4084 Compare June 3, 2025 12:11
@sjorsdonkers sjorsdonkers marked this pull request as ready for review June 3, 2025 14:06
@sjorsdonkers sjorsdonkers requested a review from karlseguin June 3, 2025 14:13
@karlseguin karlseguin merged commit 234e7af into main Jun 4, 2025
21 checks passed
@karlseguin karlseguin deleted the HTMLInputElement-properties branch June 4, 2025 06:22
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants