Skip to content
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

Rely less on anchors #3

Closed
Rich-Harris opened this issue Nov 21, 2016 · 1 comment
Closed

Rely less on anchors #3

Rich-Harris opened this issue Nov 21, 2016 · 1 comment

Comments

@Rich-Harris
Copy link
Member

Currently, Svelte peppers the DOM with comments for every {{#if..}} or {{#each...}} block:

<!--#if visible-->

In many cases (e.g. where the block is that last thing in the element's fragment, or where the block is followed by an element that is never removed) that's unnecessary.

@Swatinem
Copy link
Member

Swatinem commented Dec 5, 2016

I was thinking about this a bit. I already factored this out into generator.createAnchor.

The changes needed are a bit complex though.

  • The previous sibling needs to know if the next sibling is a static element or not to avoid creating an anchor.
  • And the next sibling needs to know that is actually needs to create an identifier (see needsIdentifier of generator.addElement).

I would have to read through your snippet code to understand how it works, maybe it can be leveraged to do something like this.

Conduitry added a commit that referenced this issue Apr 19, 2017
Rich-Harris added a commit that referenced this issue Apr 25, 2017
Rich-Harris added a commit that referenced this issue Apr 25, 2017
Anchor-less if and each blocks
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

No branches or pull requests

2 participants