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

CIF-2948: parse response html in the current browsing context #955

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

buuhuu
Copy link
Contributor

@buuhuu buuhuu commented Sep 5, 2022

Description

This change replaces the use of DOMParser in the load more handlers of product collections with a document.createRange().createContextualFragment.

The DOMParser previously parsed the returned html without any browsing context, hence flagged as scripting disabled. This causes all nodes in <noscript> tags to be parsed as dom nodes.

The image v2 component on the other hand expects the content of the <noscript> tag to be pure text, which is the expected for javascript enabled browsers. Because of this the image v2 component was not working for product list experience fragments in combination with load more yet.

Related Issue

CIF-2948

Motivation and Context

How Has This Been Tested?

Locally, existing uint tests

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Merging #955 (9422782) into master (60cdd75) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #955      +/-   ##
============================================
- Coverage     89.47%   89.46%   -0.01%     
  Complexity     2204     2204              
============================================
  Files           351      351              
  Lines          9860     9857       -3     
  Branches       1422     1422              
============================================
- Hits           8822     8819       -3     
  Misses          742      742              
  Partials        296      296              
Flag Coverage Δ
integration 52.17% <ø> (ø)
jest 86.55% <ø> (ø)
karma 95.32% <100.00%> (-0.01%) ⬇️
unittests 88.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...oductcollection/clientlibs/js/productcollection.js 87.71% <100.00%> (-0.22%) ⬇️
...oductcollection/clientlibs/js/productcollection.js 89.55% <100.00%> (-0.31%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@buuhuu buuhuu requested review from LSantha and herzog31 September 5, 2022 10:54
@buuhuu buuhuu marked this pull request as ready for review September 5, 2022 10:54
@herzog31 herzog31 added bug Something isn't working verified labels Sep 9, 2022
@herzog31 herzog31 merged commit 2dd2b2c into master Sep 9, 2022
@herzog31 herzog31 deleted the issue/CIF-2948 branch September 9, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants