Skip to content

Misc changes + version 0.4.2 bump #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

rmorshea
Copy link
Collaborator

Summary

Fixes several things:

  1. html_to_vdom did not return the whole HTML model.
  2. Reworks how the transform function is applied to the model after its been converted to VDOM.
  3. Fixes typing issue with Element function signature.

Return whole HTML model

If your html looked like this:

<div/>
<p/>

The function only returned the model for the first div. Now it returns a wrapper div around both elements.

Reworks how transform is applied

The transform was a little difficult to work with given the time at which it was applied. It's more intuitive for the transform to get applied from the root node to leafs rather than the other way around. It also makes the underlying code a little easier to reason about.

Fix Element function protocol type

The Element functions signature was previously defined by a Protocol with a __call__ attribute, however this didn't really work as expected.

I wanted to enforce (self: Element, *args: Any, **kwargs: Any) where *args, **kwargs was actually optional (i.e. functions conforming to the protocol could accept any, or no other arguments besides self).

See python/mypy#5876 for details.

If your html looked like this:

```
<div/>
<p/>
```

The function only returned the model for the first div. Now
it returns a list of models that are at the root level.
@rmorshea rmorshea changed the title Fix HTML to VDOM transform + version 0.4.2 bump Misc changes + version 0.4.2 bump May 27, 2019
@rmorshea rmorshea closed this May 27, 2019
@rmorshea
Copy link
Collaborator Author

Wrong branch

@rmorshea rmorshea deleted the fix-html-to-vdom branch August 4, 2019 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant