Skip to content

Commit

Permalink
Creating normalized fragments
Browse files Browse the repository at this point in the history
There is a method I've never used that *might* speed things up
in terms of tree walking, and improve, in general, layout
expectations.

This branch is here to test that's the case.
  • Loading branch information
WebReflection committed Jan 14, 2021
1 parent cf2a494 commit 7c16038
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion async.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cjs/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const isImportNodeLengthWrong = importNode.length != 1;
// later on, so that paths are retrieved from one already parsed,
// hence without missing child nodes once re-cloned.
const createFragment = isImportNodeLengthWrong ?
(text, type) => importNode.call(
(text, type, normalize) => importNode.call(
document,
createContent(text, type),
createContent(text, type, normalize),
true
) :
createContent;
Expand Down
2 changes: 1 addition & 1 deletion cjs/rabbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const createEntry = (type, template) => {
// operation based on the same template, i.e. data => html`<p>${data}</p>`
const mapTemplate = (type, template) => {
const text = instrument(template, prefix, type === 'svg');
const content = createFragment(text, type);
const content = createFragment(text, type, true);
// once instrumented and reproduced as fragment, it's crawled
// to find out where each update is in the fragment tree
const tw = createWalker(content);
Expand Down

0 comments on commit 7c16038

Please sign in to comment.