Skip to content

Commit

Permalink
apply sync setters in args
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 3, 2021
1 parent 0a018c2 commit 4965587
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export async function runBuild(rootDir: string, isDev: boolean, generateApi: boo

async function createRootPackage(opts: BuildOptions) {
if (opts.isDev) {
await emptyDir(opts.distDir);
await emptyDir(opts.distTestsDir);
} else {
await ensureDir(opts.distDir);
await ensureDir(opts.distTestsDir);
} else {
await emptyDir(opts.distDir);
await emptyDir(opts.distTestsDir);
}

await ensureDir(opts.distIntegrationDir);
Expand Down
11 changes: 9 additions & 2 deletions src/lib/web-worker/worker-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,20 @@ export const callMethod = (
immediateSetters?: ImmediateSetter[],
newInstanceId?: number
) => {
applyBeforeSyncSetters(instance[WinIdKey], instance);
const winId = instance[WinIdKey];
applyBeforeSyncSetters(winId, instance);

args.forEach((arg) => {
if (arg) {
applyBeforeSyncSetters(winId, arg);
}
});

const rtn = queueTask(
instance,
AccessType.CallMethod,
memberPath,
serializeForMain(instance[WinIdKey], instance[InstanceIdKey], args),
serializeForMain(winId, instance[InstanceIdKey], args),
immediateSetters,
newInstanceId
);
Expand Down
13 changes: 13 additions & 0 deletions tests/platform/node/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ <h1 class="title">Node</h1>
</script>
</li>

<li>
<strong>compareDocumentPosition()</strong>
<code id="testCompareDocumentPosition"></code>
<script type="text/partytown">
(function () {
const elm = document.getElementById('testCompareDocumentPosition');
const div = document.createElement('div');
const p = elm.compareDocumentPosition(div);
elm.textContent = p;
})();
</script>
</li>

<script type="text/partytown">
(function () {
document.body.classList.add('completed');
Expand Down
3 changes: 3 additions & 0 deletions tests/platform/node/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ test('node', async ({ page }) => {

const testFragmentChildNodes = page.locator('#testFragmentChildNodes');
await expect(testFragmentChildNodes).toHaveText('1 DIV SPAN fragment');

const testCompareDocumentPosition = page.locator('#testCompareDocumentPosition');
await expect(testCompareDocumentPosition).toHaveText('37');
});

1 comment on commit 4965587

@vercel
Copy link

@vercel vercel bot commented on 4965587 Oct 3, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.