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

feat(engine): getRootNode in patched nodes #786

Merged
merged 6 commits into from
Nov 5, 2018

Conversation

jodarove
Copy link
Contributor

@jodarove jodarove commented Oct 30, 2018

implementation.

Adds the getRootNode for patches nodes.

Details

Reopening: #744

Changes enclosed:

Does this PR introduce a breaking change?

  • Yes
  • No

@jodarove jodarove force-pushed the jodarove/get-root-node-revisit branch from 2176e59 to da13671 Compare October 30, 2018 03:05
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: f739710 | Target commit: da13671

lwc-engine-benchmark

table-append-1k metric base(f739710) target(da13671) trend
benchmark-table/append/1k duration 145.90 (±3.20 ms) 148.75 (±3.10 ms) +2.8ms (2.0%) 👎
table-clear-1k metric base(f739710) target(da13671) trend
benchmark-table/clear/1k duration 5.90 (±0.40 ms) 5.90 (±0.40 ms) 0.0ms (0.0%) 👌
table-create-10k metric base(f739710) target(da13671) trend
benchmark-table/create/10k duration 865.60 (±5.50 ms) 886.20 (±6.25 ms) +20.6ms (2.4%) 👎
table-create-1k metric base(f739710) target(da13671) trend
benchmark-table/create/1k duration 113.95 (±2.15 ms) 115.80 (±2.20 ms) +1.8ms (1.6%) 👌
table-update-10th-1k metric base(f739710) target(da13671) trend
benchmark-table/update-10th/1k duration 75.75 (±2.00 ms) 88.25 (±2.65 ms) +12.5ms (16.5%) 👎
tablecmp-append-1k metric base(f739710) target(da13671) trend
benchmark-table-component/append/1k duration 225.85 (±14.60 ms) 233.25 (±16.30 ms) +7.4ms (3.3%) 👌
tablecmp-clear-1k metric base(f739710) target(da13671) trend
benchmark-table-component/clear/1k duration 11.75 (±1.90 ms) 11.50 (±1.70 ms) -0.3ms (2.1%) 👌
tablecmp-create-10k metric base(f739710) target(da13671) trend
benchmark-table-component/create/10k duration 1659.90 (±11.60 ms) 1659.95 (±11.40 ms) +0.0ms (0.0%) 👌
tablecmp-create-1k metric base(f739710) target(da13671) trend
benchmark-table-component/create/1k duration 196.05 (±5.65 ms) 201.15 (±5.40 ms) +5.1ms (2.6%) 👎
tablecmp-update-10th-1k metric base(f739710) target(da13671) trend
benchmark-table-component/update-10th/1k duration 67.50 (±4.90 ms) 72.15 (±4.10 ms) +4.7ms (6.9%) 👎
wc-append-1k metric base(f739710) target(da13671) trend
benchmark-table-wc/append/1k duration 231.75 (±8.95 ms) 233.55 (±9.35 ms) +1.8ms (0.8%) 👌
wc-clear-1k metric base(f739710) target(da13671) trend
benchmark-table-wc/clear/1k duration 21.60 (±2.60 ms) 22.30 (±2.30 ms) +0.7ms (3.2%) 👎
wc-create-10k metric base(f739710) target(da13671) trend
benchmark-table-wc/create/10k duration 1685.95 (±39.05 ms) 1732.05 (±28.05 ms) +46.1ms (2.7%) 👎
wc-create-1k metric base(f739710) target(da13671) trend
benchmark-table-wc/create/1k duration 203.00 (±5.15 ms) 204.65 (±5.50 ms) +1.6ms (0.8%) 👌
wc-update-10th-1k metric base(f739710) target(da13671) trend
benchmark-table-wc/update-10th/1k duration 69.55 (±3.70 ms) 72.85 (±4.25 ms) +3.3ms (4.7%) 👎

@jodarove
Copy link
Contributor Author

comments from the previous pull request:

we currently have one implementation of getRootNode, which is used in the events from faux-shadow: https://github.com/salesforce/lwc/blob/master/packages/lwc-engine/src/faux-shadow/node.ts#L65

which currently have some issues:

  • returns the custom-element instead of a shadow.
  • getRootNode() on an slotted element return the host of the component accepting the slot, which is not correct on cases with multilevel deep of slots.

it was agreed that we should change the existing getRootNode to match the native behavior. although it might involve some extra work cause will change from returning the host to return the shadow

// it is coming from a slotted element
isChildNode(getRootNode.call(target, event), currentTarget as Node) ||
// it is not composed and its is coming from from shadow
(composed === false && getRootNode.call(target) === currentTarget)
Copy link
Contributor Author

@jodarove jodarove Oct 30, 2018

Choose a reason for hiding this comment

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

here the second call to getRootNode.call(target) can be cached, since const { composed } = event as any; and we are ensuring that composed === false that's why the if condition was divided into 2, so the getRootNode only had to be calculated only once

@jodarove
Copy link
Contributor Author

@caridy @davidturissini @ekashida some things missing, but the general idea can be reviewed if you have time.

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: f739710 | Target commit: d3a0baa

lwc-engine-benchmark

table-append-1k metric base(f739710) target(d3a0baa) trend
benchmark-table/append/1k duration 145.90 (±3.20 ms) 152.80 (±4.10 ms) +6.9ms (4.7%) 👎
table-clear-1k metric base(f739710) target(d3a0baa) trend
benchmark-table/clear/1k duration 5.90 (±0.40 ms) 6.30 (±0.45 ms) +0.4ms (6.8%) 👎
table-create-10k metric base(f739710) target(d3a0baa) trend
benchmark-table/create/10k duration 865.60 (±5.50 ms) 861.55 (±5.55 ms) -4.1ms (0.5%) 👍
table-create-1k metric base(f739710) target(d3a0baa) trend
benchmark-table/create/1k duration 113.95 (±2.15 ms) 114.20 (±2.55 ms) +0.3ms (0.2%) 👌
table-update-10th-1k metric base(f739710) target(d3a0baa) trend
benchmark-table/update-10th/1k duration 75.75 (±2.00 ms) 75.55 (±2.60 ms) -0.2ms (0.3%) 👌
tablecmp-append-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-component/append/1k duration 225.85 (±14.60 ms) 232.60 (±13.25 ms) +6.7ms (3.0%) 👌
tablecmp-clear-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-component/clear/1k duration 11.75 (±1.90 ms) 11.85 (±1.50 ms) +0.1ms (0.9%) 👌
tablecmp-create-10k metric base(f739710) target(d3a0baa) trend
benchmark-table-component/create/10k duration 1659.90 (±11.60 ms) 1673.35 (±12.70 ms) +13.4ms (0.8%) 👎
tablecmp-create-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-component/create/1k duration 196.05 (±5.65 ms) 197.65 (±4.35 ms) +1.6ms (0.8%) 👌
tablecmp-update-10th-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-component/update-10th/1k duration 67.50 (±4.90 ms) 70.40 (±3.80 ms) +2.9ms (4.3%) 👌
wc-append-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-wc/append/1k duration 231.75 (±8.95 ms) 235.80 (±9.80 ms) +4.1ms (1.7%) 👌
wc-clear-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-wc/clear/1k duration 21.60 (±2.60 ms) 22.90 (±2.10 ms) +1.3ms (6.0%) 👎
wc-create-10k metric base(f739710) target(d3a0baa) trend
benchmark-table-wc/create/10k duration 1685.95 (±39.05 ms) 1694.50 (±58.25 ms) +8.5ms (0.5%) 👌
wc-create-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-wc/create/1k duration 203.00 (±5.15 ms) 205.55 (±5.20 ms) +2.6ms (1.3%) 👌
wc-update-10th-1k metric base(f739710) target(d3a0baa) trend
benchmark-table-wc/update-10th/1k duration 69.55 (±3.70 ms) 71.70 (±4.55 ms) +2.2ms (3.1%) 👌

@caridy
Copy link
Contributor

caridy commented Oct 30, 2018

@davidturissini should definitely look at this. Base on a very quick pass, it LGTM, but I have to dig in more.

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 9afcd3b | Target commit: 3d3c1b6

lwc-engine-benchmark

table-append-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table/append/1k duration 153.35 (±4.05 ms) 168.00 (±5.50 ms) +14.6ms (9.6%) 👎
table-clear-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table/clear/1k duration 6.65 (±0.35 ms) 7.60 (±0.70 ms) +0.9ms (14.3%) 👎
table-create-10k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table/create/10k duration 892.75 (±7.30 ms) 980.95 (±10.95 ms) +88.2ms (9.9%) 👎
table-create-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table/create/1k duration 116.35 (±2.25 ms) 122.95 (±3.50 ms) +6.6ms (5.7%) 👎
table-update-10th-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table/update-10th/1k duration 76.65 (±3.25 ms) 84.45 (±3.90 ms) +7.8ms (10.2%) 👎
tablecmp-append-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-component/append/1k duration 229.40 (±18.20 ms) 257.20 (±8.05 ms) +27.8ms (12.1%) 👎
tablecmp-clear-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-component/clear/1k duration 12.25 (±1.65 ms) 12.75 (±1.65 ms) +0.5ms (4.1%) 👌
tablecmp-create-10k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-component/create/10k duration 1681.55 (±14.90 ms) 1786.25 (±18.10 ms) +104.7ms (6.2%) 👎
tablecmp-create-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-component/create/1k duration 201.55 (±6.95 ms) 209.60 (±6.40 ms) +8.0ms (4.0%) 👎
tablecmp-update-10th-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-component/update-10th/1k duration 70.90 (±6.10 ms) 74.10 (±6.15 ms) +3.2ms (4.5%) 👌
wc-append-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-wc/append/1k duration 236.60 (±11.10 ms) 248.75 (±18.35 ms) +12.2ms (5.1%) 👎
wc-clear-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-wc/clear/1k duration 23.30 (±2.40 ms) 26.50 (±2.15 ms) +3.2ms (13.7%) 👎
wc-create-10k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-wc/create/10k duration 1662.55 (±64.15 ms) 1926.10 (±34.35 ms) +263.5ms (15.9%) 👎
wc-create-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-wc/create/1k duration 206.75 (±4.35 ms) 226.70 (±6.05 ms) +19.9ms (9.6%) 👎
wc-update-10th-1k metric base(9afcd3b) target(3d3c1b6) trend
benchmark-table-wc/update-10th/1k duration 73.95 (±6.15 ms) 79.70 (±4.25 ms) +5.7ms (7.8%) 👎

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 9afcd3b | Target commit: 25c77f8

lwc-engine-benchmark

table-append-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table/append/1k duration 153.35 (±4.05 ms) 172.80 (±3.80 ms) +19.4ms (12.7%) 👎
table-clear-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table/clear/1k duration 6.65 (±0.35 ms) 7.70 (±0.35 ms) +1.0ms (15.8%) 👎
table-create-10k metric base(9afcd3b) target(25c77f8) trend
benchmark-table/create/10k duration 892.75 (±7.30 ms) 951.35 (±6.00 ms) +58.6ms (6.6%) 👎
table-create-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table/create/1k duration 116.35 (±2.25 ms) 122.00 (±2.75 ms) +5.7ms (4.9%) 👎
table-update-10th-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table/update-10th/1k duration 76.65 (±3.25 ms) 83.90 (±4.70 ms) +7.3ms (9.5%) 👎
tablecmp-append-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-component/append/1k duration 229.40 (±18.20 ms) 272.30 (±8.20 ms) +42.9ms (18.7%) 👎
tablecmp-clear-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-component/clear/1k duration 12.25 (±1.65 ms) 13.70 (±1.90 ms) +1.4ms (11.8%) 👎
tablecmp-create-10k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-component/create/10k duration 1681.55 (±14.90 ms) 1885.55 (±19.70 ms) +204.0ms (12.1%) 👎
tablecmp-create-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-component/create/1k duration 201.55 (±6.95 ms) 215.90 (±5.25 ms) +14.3ms (7.1%) 👎
tablecmp-update-10th-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-component/update-10th/1k duration 70.90 (±6.10 ms) 76.15 (±5.40 ms) +5.3ms (7.4%) 👎
wc-append-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-wc/append/1k duration 236.60 (±11.10 ms) 244.10 (±17.15 ms) +7.5ms (3.2%) 👎
wc-clear-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-wc/clear/1k duration 23.30 (±2.40 ms) 24.55 (±3.05 ms) +1.3ms (5.4%) 👌
wc-create-10k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-wc/create/10k duration 1662.55 (±64.15 ms) 1925.65 (±67.70 ms) +263.1ms (15.8%) 👎
wc-create-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-wc/create/1k duration 206.75 (±4.35 ms) 223.55 (±5.45 ms) +16.8ms (8.1%) 👎
wc-update-10th-1k metric base(9afcd3b) target(25c77f8) trend
benchmark-table-wc/update-10th/1k duration 73.95 (±6.15 ms) 78.50 (±5.55 ms) +4.5ms (6.2%) 👎

@jodarove
Copy link
Contributor Author

thanks @caridy , this is ready for a full review. fyi/ @davidturissini @ekashida

implementation.

Adds the getRootNode for patches nodes.
missing:

- check if #750 is resolved, if that is the case, add a test for it.
- check types in function calls.
- refactor and organize anything i might have left.
should be called when the event comes from within nested slots.

fixes: #750
of names, and use GetRootNodeOptions type.
@jodarove jodarove force-pushed the jodarove/get-root-node-revisit branch from 25c77f8 to 40b5ec9 Compare November 1, 2018 18:14
@jodarove jodarove force-pushed the jodarove/get-root-node-revisit branch from 40b5ec9 to f5175b1 Compare November 1, 2018 18:23
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 5537b7a | Target commit: 40b5ec9

lwc-engine-benchmark

table-append-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table/append/1k duration 162.15 (±3.95 ms) 156.50 (±4.55 ms) -5.6ms (3.5%) 👍
table-clear-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table/clear/1k duration 7.20 (±0.50 ms) 6.40 (±0.40 ms) -0.8ms (11.1%) 👍
table-create-10k metric base(5537b7a) target(40b5ec9) trend
benchmark-table/create/10k duration 958.05 (±8.30 ms) 936.20 (±7.10 ms) -21.8ms (2.3%) 👍
table-create-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table/create/1k duration 121.30 (±2.40 ms) 121.50 (±3.10 ms) +0.2ms (0.2%) 👌
table-update-10th-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table/update-10th/1k duration 81.80 (±1.95 ms) 89.30 (±4.10 ms) +7.5ms (9.2%) 👎
tablecmp-append-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-component/append/1k duration 261.70 (±8.45 ms) 259.20 (±7.60 ms) -2.5ms (1.0%) 👌
tablecmp-clear-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-component/clear/1k duration 13.85 (±1.40 ms) 12.80 (±1.55 ms) -1.1ms (7.6%) 👍
tablecmp-create-10k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-component/create/10k duration 1834.85 (±11.85 ms) 1854.40 (±14.60 ms) +19.6ms (1.1%) 👎
tablecmp-create-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-component/create/1k duration 214.70 (±4.30 ms) 209.05 (±5.85 ms) -5.6ms (2.6%) 👍
tablecmp-update-10th-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-component/update-10th/1k duration 73.75 (±5.65 ms) 70.15 (±4.35 ms) -3.6ms (4.9%) 👌
wc-append-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-wc/append/1k duration 255.15 (±10.50 ms) 244.65 (±15.55 ms) -10.5ms (4.1%) 👍
wc-clear-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-wc/clear/1k duration 24.80 (±1.85 ms) 24.65 (±2.10 ms) -0.1ms (0.6%) 👌
wc-create-10k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-wc/create/10k duration 1914.20 (±22.50 ms) 1923.55 (±37.90 ms) +9.3ms (0.5%) 👌
wc-create-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-wc/create/1k duration 223.95 (±4.40 ms) 217.40 (±5.60 ms) -6.5ms (2.9%) 👍
wc-update-10th-1k metric base(5537b7a) target(40b5ec9) trend
benchmark-table-wc/update-10th/1k duration 76.00 (±5.05 ms) 73.90 (±5.55 ms) -2.1ms (2.8%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 5537b7a | Target commit: f5175b1

lwc-engine-benchmark

table-append-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table/append/1k duration 162.15 (±3.95 ms) 154.50 (±3.55 ms) -7.6ms (4.7%) 👍
table-clear-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table/clear/1k duration 7.20 (±0.50 ms) 6.40 (±0.60 ms) -0.8ms (11.1%) 👍
table-create-10k metric base(5537b7a) target(f5175b1) trend
benchmark-table/create/10k duration 958.05 (±8.30 ms) 943.55 (±5.85 ms) -14.5ms (1.5%) 👍
table-create-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table/create/1k duration 121.30 (±2.40 ms) 119.35 (±3.20 ms) -2.0ms (1.6%) 👍
table-update-10th-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table/update-10th/1k duration 81.80 (±1.95 ms) 88.80 (±4.20 ms) +7.0ms (8.6%) 👌
tablecmp-append-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-component/append/1k duration 261.70 (±8.45 ms) 262.00 (±7.85 ms) +0.3ms (0.1%) 👌
tablecmp-clear-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-component/clear/1k duration 13.85 (±1.40 ms) 12.95 (±1.50 ms) -0.9ms (6.5%) 👌
tablecmp-create-10k metric base(5537b7a) target(f5175b1) trend
benchmark-table-component/create/10k duration 1834.85 (±11.85 ms) 1843.40 (±11.15 ms) +8.6ms (0.5%) 👌
tablecmp-create-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-component/create/1k duration 214.70 (±4.30 ms) 208.65 (±6.00 ms) -6.1ms (2.8%) 👍
tablecmp-update-10th-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-component/update-10th/1k duration 73.75 (±5.65 ms) 72.95 (±5.00 ms) -0.8ms (1.1%) 👌
wc-append-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-wc/append/1k duration 255.15 (±10.50 ms) 248.70 (±15.50 ms) -6.4ms (2.5%) 👍
wc-clear-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-wc/clear/1k duration 24.80 (±1.85 ms) 24.05 (±2.90 ms) -0.7ms (3.0%) 👌
wc-create-10k metric base(5537b7a) target(f5175b1) trend
benchmark-table-wc/create/10k duration 1914.20 (±22.50 ms) 1836.40 (±63.35 ms) -77.8ms (4.1%) 👍
wc-create-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-wc/create/1k duration 223.95 (±4.40 ms) 221.30 (±5.75 ms) -2.6ms (1.2%) 👍
wc-update-10th-1k metric base(5537b7a) target(f5175b1) trend
benchmark-table-wc/update-10th/1k duration 76.00 (±5.05 ms) 73.90 (±4.45 ms) -2.1ms (2.8%) 👌


// is SyntheticShadowRootInterface
if ('mode' in rootNode && 'delegatesFocus' in rootNode) {
rootNode = getHost(rootNode);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this check? This function should never run in native mode. The only thing I can think of is if getRootNode returns a document. It seems strange for this method to either return an Element or document?

Copy link
Contributor Author

@jodarove jodarove Nov 2, 2018

Choose a reason for hiding this comment

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

when getRootNode with composed = true or getRootNode in an lwc root element ? in those cases it will return a document, this check is for those cases. this method returns a Node

@@ -240,6 +240,10 @@ export class SyntheticShadowRoot extends DocumentFragment implements ShadowRoot
getSelection(this: SyntheticShadowRootInterface): Selection | null {
throw new Error();
}

getRootNode(options?: GetRootNodeOptions): Node {
return getRootNode.call(this, options);
Copy link
Contributor

Choose a reason for hiding this comment

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

add this type. Do we need the indirection here or can we just implement getRootNode right here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davidturissini i added the this type (on both). what i don't fully understand is:

can we just implement getRootNode right here

getRootNode (now getRootNodeGetter) is used in some other places, and not alway on a patched element (for ex: events) would an implementation here will lead to duplicated code? can you explain more so i can understand better?

@@ -323,6 +367,9 @@ export function PatchedNode(node: Node): NodeConstructor {
}
return parentNode;
}
getRootNode(options?: GetRootNodeOptions): Node {
return getRootNode.call(this, options);
Copy link
Contributor

Choose a reason for hiding this comment

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

this type. Same question as above. I wonder if we need the indirection or can we simple implement here

- remove abstractions to improve test readability.
- add a test for when elements are added to the shadow with innerHTML.
- renamed the regular method to getRootNodeGetter to have the this.
- added the this type to Node.getRootNode and SyntheticShadowRoot.getRootNode
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 9381315 | Target commit: d5e5514

lwc-engine-benchmark

table-append-1k metric base(9381315) target(d5e5514) trend
benchmark-table/append/1k duration 153.90 (±4.85 ms) 154.50 (±5.15 ms) +0.6ms (0.4%) 👌
table-clear-1k metric base(9381315) target(d5e5514) trend
benchmark-table/clear/1k duration 6.15 (±0.30 ms) 6.40 (±0.30 ms) +0.3ms (4.1%) 👎
table-create-10k metric base(9381315) target(d5e5514) trend
benchmark-table/create/10k duration 916.15 (±5.45 ms) 912.90 (±4.95 ms) -3.3ms (0.4%) 👍
table-create-1k metric base(9381315) target(d5e5514) trend
benchmark-table/create/1k duration 119.55 (±2.95 ms) 118.50 (±2.85 ms) -1.0ms (0.9%) 👌
table-update-10th-1k metric base(9381315) target(d5e5514) trend
benchmark-table/update-10th/1k duration 79.65 (±4.55 ms) 80.00 (±4.20 ms) +0.3ms (0.4%) 👌
tablecmp-append-1k metric base(9381315) target(d5e5514) trend
benchmark-table-component/append/1k duration 253.85 (±5.35 ms) 257.45 (±4.80 ms) +3.6ms (1.4%) 👌
tablecmp-clear-1k metric base(9381315) target(d5e5514) trend
benchmark-table-component/clear/1k duration 12.80 (±2.00 ms) 12.60 (±1.55 ms) -0.2ms (1.6%) 👌
tablecmp-create-10k metric base(9381315) target(d5e5514) trend
benchmark-table-component/create/10k duration 1793.90 (±12.10 ms) 1808.35 (±14.20 ms) +14.4ms (0.8%) 👎
tablecmp-create-1k metric base(9381315) target(d5e5514) trend
benchmark-table-component/create/1k duration 208.25 (±6.30 ms) 212.15 (±5.75 ms) +3.9ms (1.9%) 👌
tablecmp-update-10th-1k metric base(9381315) target(d5e5514) trend
benchmark-table-component/update-10th/1k duration 71.15 (±4.95 ms) 72.30 (±5.10 ms) +1.1ms (1.6%) 👌
wc-append-1k metric base(9381315) target(d5e5514) trend
benchmark-table-wc/append/1k duration 287.75 (±12.15 ms) 237.55 (±14.50 ms) -50.2ms (17.4%) 👍
wc-clear-1k metric base(9381315) target(d5e5514) trend
benchmark-table-wc/clear/1k duration 24.75 (±1.80 ms) 23.55 (±2.85 ms) -1.2ms (4.8%) 👌
wc-create-10k metric base(9381315) target(d5e5514) trend
benchmark-table-wc/create/10k duration 4269.15 (±20.20 ms) 1807.15 (±47.65 ms) -2462.0ms (57.7%) 👍
wc-create-1k metric base(9381315) target(d5e5514) trend
benchmark-table-wc/create/1k duration 256.15 (±4.05 ms) 218.30 (±5.30 ms) -37.8ms (14.8%) 👍
wc-update-10th-1k metric base(9381315) target(d5e5514) trend
benchmark-table-wc/update-10th/1k duration 77.95 (±4.65 ms) 75.35 (±5.60 ms) -2.6ms (3.3%) 👍

@diervo diervo merged commit ede0d7b into master Nov 5, 2018
@diervo diervo deleted the jodarove/get-root-node-revisit branch November 5, 2018 22:26
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.

Listeners on this.template are not being called when the event comes from within nested slots.
4 participants