Skip to content

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.

2 participants