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: support non-canonicalised srcset attribute name #2958 #2968

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

gg-kialo
Copy link
Contributor

@gg-kialo gg-kialo commented Oct 18, 2023

Some frameworks, like React, use non-canonicalised attribute names. The spec and browsers allow this, but hammerhead is only checking if the attribute name without canonicalisation matches srcset.

By using the loweredAttr for the comparison, hammerhead will be more accepting of inputs and resolve srcset issues with React projects (fixes #2958).

See facebook/react#10863 for more background.

Purpose

Fixes #2958 to better support srcSet attributes in React applications.

Approach

Canonicalises the attribute name before comparing to srcset.

References

Related react issue (and there are various duplicates of this) - facebook/react#10863

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

@gg-kialo gg-kialo temporarily deployed to authentication October 18, 2023 08:48 — with GitHub Actions Inactive
@gg-kialo
Copy link
Contributor Author

gg-kialo commented Oct 18, 2023

fyi: both locally and in github codespaces I've been unable to get the tests to run. After running gulp test-client nothing happens after QUnit server starts to listen.

...
[10:41:29] Finished 'lint' after 12 s
[10:41:29] Finished 'build' after 17 s
[10:41:29] Starting 'test-client-run'...
QUnit server listens on http://localhost:2000

I tried adding adding a test but since removed it since it was failing. I don't think it was testing the right thing.

@gg-kialo gg-kialo temporarily deployed to CI October 18, 2023 11:05 — with GitHub Actions Inactive
@gg-kialo gg-kialo temporarily deployed to authentication October 18, 2023 11:18 — with GitHub Actions Inactive
@gg-kialo gg-kialo temporarily deployed to CI October 18, 2023 11:27 — with GitHub Actions Inactive
Copy link
Collaborator

@Aleksey28 Aleksey28 left a comment

Choose a reason for hiding this comment

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

Hi @gg-kialo,

Thank you for your contribution. We really appreciate your help. To preserve this fix from future changes, please add a test that checks this behavior.

@gg-kialo gg-kialo temporarily deployed to authentication October 18, 2023 15:02 — with GitHub Actions Inactive
@gg-kialo
Copy link
Contributor Author

I've pushed with an added test. I managed to figure how to get them to run locally (you have to open the qunit server 🤦).

fyi, I'll be OoO until Tuesday.

@gg-kialo gg-kialo temporarily deployed to CI October 19, 2023 06:43 — with GitHub Actions Inactive
Copy link
Collaborator

@Aleksey28 Aleksey28 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Please take a look at my suggestions.

test/client/fixtures/sandbox/node/methods-test.js Outdated Show resolved Hide resolved
test/client/fixtures/sandbox/node/methods-test.js Outdated Show resolved Hide resolved
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
@Aleksey28 Aleksey28 merged commit d76f0c3 into DevExpress:master Oct 24, 2023
8 checks passed
@gg-kialo gg-kialo deleted the gh-2958 branch October 24, 2023 12:35
@github-actions
Copy link

Release v31.6.3 addresses this.

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.

srcset Proxying doesn't work with React
2 participants