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

fix: make sure unknown is mapped to HTMLUnknownElement cstr #606

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

hoebbelsB
Copy link
Contributor

@hoebbelsB hoebbelsB commented Jun 25, 2024

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

The issue

Chrome maps correctly

image

WebKit browsers map other nodeNames (in this case DIRECTORY) to HTMLUnknownElement

image

Which results in the hardcoded UNKNOWN property being undefined in WebKit browsers, causing them to throw errors like a madman.

image

image

The reason

Webkit iterates over the possible APIs in a different order. It will receive directory as first nodeName which results in HTMLUnknownElement constructor. The function readOwnImplementation maintains a Set<string> with constructor names. So the first one to occupy the space for HTMLUnknownElement will be directory.

If you filter for the possible cstrImpls which have the HTMLUnknownElement constructor name, you'll get multiple results with different orderings, depending on the browser.

Broken ordering on webkit

image

Proper ordering on chrome

image

The fix

I've simply introduced a new filter that filters out all nodenames that will result in HTMLUnknownElement, but UNKNOWN. The worker will anyway fall back to HTMLUnknownElement, so there should be no change in functionality.

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

Copy link

vercel bot commented Jun 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
partytown ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 10:58am

@hoebbelsB
Copy link
Contributor Author

no idea why the test would fail because of my changes. They also fail locally for me when checking out the main branch

@gioboa
Copy link
Member

gioboa commented Jul 1, 2024

I see, thanks @hoebbelsB for your help

@aaa123eee
Copy link
Contributor

Hello @gioboa

Is there anything we can do to move it forward?

@gioboa
Copy link
Member

gioboa commented Aug 28, 2024

Hi @aaa123eee, I'm sorry. I'm no longer in the project. You can contact the builder.io team in this Discord channel
Thanks

@aaa123eee
Copy link
Contributor

Hi @aaa123eee, I'm sorry. I'm no longer in the project. You can contact the builder.io team in this Discord channel Thanks

Thanks for your reply and your contributions!

@aaa123eee
Copy link
Contributor

Hi @aaa123eee, I'm sorry. I'm no longer in the project. You can contact the builder.io team on this Discord channel Thanks

Unfortunately this link does not work for me
image

Is there anybody I can ask for a proper one? probably @adamdbradley @mhevery

@aaa123eee
Copy link
Contributor

aaa123eee commented Aug 28, 2024

there's a related issue about that #547

maybe @hamatoyogi knows 🤔

Unfortunately this link does not work for me image

Is there anybody I can ask for a proper one? probably @adamdbradley @mhevery

@gioboa
Copy link
Member

gioboa commented Aug 28, 2024

@aaa123eee can you try this one please?

@aaa123eee
Copy link
Contributor

@aaa123eee can you try this one please?

this invite works well! thank you!

@aaa123eee aaa123eee mentioned this pull request Aug 28, 2024
7 tasks
@hamatoyogi
Copy link
Contributor

there's a related issue about that #547

maybe @hamatoyogi knows 🤔

Unfortunately this link does not work for me image
Is there anybody I can ask for a proper one? probably @adamdbradley @mhevery

Hey, I'm no longer at Builder, but maybe if i tag @steve8708 something will happen 😅

@kylefowler
Copy link

Thanks for the PR, we will have a look at this next week.

@kylefowler
Copy link

I think if we can get a unit test on the change to verify behavior following our contribution guides we should be good to get this merged in. thanks for the patience here. https://github.com/BuilderIO/partytown/blob/main/CONTRIBUTING.md#submitting-issues-and-writing-tests

Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

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

Thanks @hoebbelsB for your commitment and patience 🙏
Can you add a test for this specific case and flip the double ! condition in the filter please? ( it's not that readable in this way )

@hoebbelsB
Copy link
Contributor Author

yo, cool to see you back. will do as soon as I find time! Hopefully this week

@gioboa
Copy link
Member

gioboa commented Dec 9, 2024

@hoebbelsB is this PR still valid?

@aaa123eee
Copy link
Contributor

@hoebbelsB is this PR still valid?

it definitely is!

@gioboa
Copy link
Member

gioboa commented Dec 11, 2024

@aaa123eee Do you also have this error? if yes, can you check this change to verify it please?

I've simply introduced a new filter that filters out all nodenames that will result in HTMLUnknownElement, but UNKNOWN.

@hoebbelsB based on your description I changed the filter logic.
is it correct? remove the HTMLUnknownElement with UNKNOWN and keep the others

return (constructorName !== 'HTMLUnknownElement' || elm.nodeName.toUpperCase() !== 'UNKNOWN');

@hoebbelsB
Copy link
Contributor Author

hoebbelsB commented Dec 12, 2024

@gioboa no, it's not the same as before.

I've also worked on a test to proof it. I've double checked the previous, my solution and your solution.
With previous (main), test fails on webkit only.
With your solution the test also fails on chromium & webkit.
With my solution the test passes.

@hoebbelsB hoebbelsB requested a review from gioboa December 12, 2024 14:38
Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

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

Thanks @hoebbelsB for your help
It looks good to me

@gioboa gioboa merged commit e43df90 into QwikDev:main Dec 12, 2024
9 checks passed
@stdavis
Copy link

stdavis commented Dec 19, 2024

@gioboa Is there any way that you can cut a new version that includes this fix?

@gioboa
Copy link
Member

gioboa commented Dec 19, 2024

@gioboa Is there any way that you can cut a new version that includes this fix?

Yep, I'll create the first release for the QwikDev org

@github-actions github-actions bot mentioned this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants