Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Eliminate wrapper elements #602

Merged
merged 5 commits into from
Apr 18, 2018
Merged

Conversation

SteveSandersonMS
Copy link
Member

Fixes #384. In fact it goes further and eliminates the wrapper elements in all scenarios, not just when components produce exactly one top-level node.

This PR changes how BrowserRenderer works so that it no longer inserts the extra blazor-component elements around child components. This simplifies the DOM structure, but more importantly, simplifies working with CSS because you no longer have to account for the wrappers in your selectors. The DOM structure is now completely under the control of the developer. For details on how this works (and how it preserves O(1) traversal), see the comments inside LogicalElement.ts.

All future DOM mutation logic in BrowserRenderer must use the LogicalElement APIs (unstead of directly calling native DOM insertion/removal APIs) to retain compatibility.

@SteveSandersonMS SteveSandersonMS merged commit 9adc0ed into dev Apr 18, 2018
@SteveSandersonMS SteveSandersonMS deleted the stevesa/eliminate-wrapper-elements branch April 18, 2018 12:54
@SteveSandersonMS
Copy link
Member Author

Merged because it's unlikely anyone would be requesting review changes, but @javiercn @rynowak please feel free to review if you wish.

@masonwheeler
Copy link

Yay! Keep up the good work!

@4deeptech
Copy link

This is great news. Looking forward to future progress.

@SteveSandersonMS SteveSandersonMS added this to the 0.3.0 milestone Apr 23, 2018
SteveSandersonMS added a commit to SteveSandersonMS/BlazorMigration that referenced this pull request Nov 27, 2018
* Factor out all DOM-structure modifying code into an abstraction. Currently, implementation is still backed by the same underlying DOM APIs

* Implement LogicalElement properly (store hierarchy in own property; use comment nodes as containers)

* In LogicalElement, be explicit about unsupported scenarios

* Update E2E tests to stop assuming existence of wrapper elements

* Where supported, store private properties using opaque symbols as keys
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants