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

test(engine): shadow properties in compat mode #424

Merged

Conversation

davidturissini
Copy link
Contributor

@davidturissini davidturissini commented Jun 15, 2018

Details

  • Fix for textContent, innerHTML, and outerHTML to work in compat mode.
  • Integration tests for textContent, innerHTML, and outerHTML.

Does this PR introduce a breaking change?

  • No

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: cb190af | Target commit: 780025a

lwc-engine-benchmark

table-append-1k metric base(cb190af) target(780025a) trend
benchmark-table/append/1k duration 159.70 (± 4.60 ms) 157.40 (± 5.90 ms) 1.44% 👌
table-clear-1k metric base(cb190af) target(780025a) trend
benchmark-table/clear/1k duration 12.90 (± 0.60 ms) 12.20 (± 0.70 ms) 5.43% 👍
table-create-10k metric base(cb190af) target(780025a) trend
benchmark-table/create/10k duration 922.70 (± 5.80 ms) 927.80 (± 7.10 ms) -0.55% 👌
table-create-1k metric base(cb190af) target(780025a) trend
benchmark-table/create/1k duration 103.50 (± 2.40 ms) 104.30 (± 2.40 ms) -0.77% 👌
table-update-10th-1k metric base(cb190af) target(780025a) trend
benchmark-table/update-10th/1k duration 90.10 (± 5.90 ms) 91.20 (± 5.80 ms) -1.22% 👌
tablecmp-append-1k metric base(cb190af) target(780025a) trend
benchmark-table-component/append/1k duration 268.30 (± 5.20 ms) 266.40 (± 5.60 ms) 0.71% 👌
tablecmp-clear-1k metric base(cb190af) target(780025a) trend
benchmark-table/clear/1k duration 37.10 (± 2.10 ms) 38.60 (± 2.40 ms) -4.04% 👌
tablecmp-create-10k metric base(cb190af) target(780025a) trend
benchmark-table-component/create/10k duration 1889.00 (± 13.60 ms) 1856.50 (± 20.30 ms) 1.72% 👍
tablecmp-create-1k metric base(cb190af) target(780025a) trend
benchmark-table-component/create/1k duration 203.80 (± 3.80 ms) 205.40 (± 4.80 ms) -0.79% 👌
tablecmp-update-10th-1k metric base(cb190af) target(780025a) trend
benchmark-table-component/update-10th/1k duration 75.80 (± 3.70 ms) 77.40 (± 4.90 ms) -2.11% 👌

@@ -125,7 +125,7 @@ function lightDomChildNodesGetter(this: HTMLElement): Node[] {
const customElementVM = getCustomElementVM(this);
// lwc element, in which case we need to get only the nodes
// that were slotted
const slots = shadowRootQuerySelectorAll(customElementVM, 'slot');
const slots = nativeQuerySelectorAll.call(customElementVM.elm, 'slot');
children = ArrayReduce.call(slots, (seed, slot) => {
return seed.concat(ArraySlice.call(nativeChildNodesGetter.call(slot)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should only reduce here if the slot belongs to us, otherwise we will reduce all slots in the sub-tree

children = ArrayReduce.call(slots, (seed, slot) => {
return seed.concat(ArraySlice.call(nativeChildNodesGetter.call(slot)));
if (isNodeOwnedByVM(customElementVM, slot)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidturissini I have added the optimization that we talked about, plus we were using .concat, we are not using the internal cached version of the push that does the same.

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: cb190af | Target commit: 601db3e

lwc-engine-benchmark

table-append-1k metric base(cb190af) target(601db3e) trend
benchmark-table/append/1k duration 159.70 (± 4.60 ms) 153.40 (± 5.50 ms) 3.94% 👍
table-clear-1k metric base(cb190af) target(601db3e) trend
benchmark-table/clear/1k duration 12.90 (± 0.60 ms) 11.80 (± 0.70 ms) 8.53% 👍
table-create-10k metric base(cb190af) target(601db3e) trend
benchmark-table/create/10k duration 922.70 (± 5.80 ms) 937.70 (± 8.20 ms) -1.63% 👎
table-create-1k metric base(cb190af) target(601db3e) trend
benchmark-table/create/1k duration 103.50 (± 2.40 ms) 105.10 (± 1.90 ms) -1.55% 👌
table-update-10th-1k metric base(cb190af) target(601db3e) trend
benchmark-table/update-10th/1k duration 90.10 (± 5.90 ms) 93.30 (± 3.80 ms) -3.55% 👎
tablecmp-append-1k metric base(cb190af) target(601db3e) trend
benchmark-table-component/append/1k duration 268.30 (± 5.20 ms) 262.00 (± 3.40 ms) 2.35% 👍
tablecmp-clear-1k metric base(cb190af) target(601db3e) trend
benchmark-table/clear/1k duration 37.10 (± 2.10 ms) 36.90 (± 2.10 ms) 0.54% 👌
tablecmp-create-10k metric base(cb190af) target(601db3e) trend
benchmark-table-component/create/10k duration 1889.00 (± 13.60 ms) 1827.30 (± 19.50 ms) 3.27% 👍
tablecmp-create-1k metric base(cb190af) target(601db3e) trend
benchmark-table-component/create/1k duration 203.80 (± 3.80 ms) 203.90 (± 4.20 ms) -0.05% 👌
tablecmp-update-10th-1k metric base(cb190af) target(601db3e) trend
benchmark-table-component/update-10th/1k duration 75.80 (± 3.70 ms) 75.10 (± 3.15 ms) 0.92% 👌

@caridy
Copy link
Contributor

caridy commented Jun 16, 2018

@davidturissini I think my optimization broke this again :(

@caridy caridy changed the title test(engine): integration tests for shadow properties test(engine): shadow properties in compat mode Jun 21, 2018
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: c8d0f9c | Target commit: 8313c22

lwc-engine-benchmark

table-append-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/append/1k duration 149.30 (± 4.50 ms) 152.90 (± 7.30 ms) -2.41% 👌
table-clear-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/clear/1k duration 11.70 (± 0.50 ms) 11.80 (± 0.50 ms) -0.85% 👌
table-create-10k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/create/10k duration 909.50 (± 4.90 ms) 893.80 (± 6.40 ms) 1.73% 👍
table-create-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/create/1k duration 101.10 (± 2.80 ms) 101.75 (± 2.30 ms) -0.64% 👌
table-update-10th-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/update-10th/1k duration 87.30 (± 6.00 ms) 88.20 (± 5.20 ms) -1.03% 👌
tablecmp-append-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table-component/append/1k duration 264.80 (± 4.10 ms) 258.00 (± 3.00 ms) 2.57% 👍
tablecmp-clear-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table/clear/1k duration 36.80 (± 1.90 ms) 35.00 (± 1.80 ms) 4.89% 👍
tablecmp-create-10k metric base(c8d0f9c) target(8313c22) trend
benchmark-table-component/create/10k duration 1832.40 (± 20.70 ms) 1840.60 (± 18.70 ms) -0.45% 👎
tablecmp-create-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table-component/create/1k duration 203.70 (± 4.20 ms) 200.00 (± 4.60 ms) 1.82% 👍
tablecmp-update-10th-1k metric base(c8d0f9c) target(8313c22) trend
benchmark-table-component/update-10th/1k duration 77.20 (± 3.90 ms) 74.60 (± 4.90 ms) 3.37% 👌

@caridy caridy merged commit 50fbc52 into master Jun 21, 2018
@caridy caridy deleted the dturissini/textcontent-innerhtml-outerhtml-integration-tests branch June 21, 2018 16:49
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.

3 participants