Skip to content

Commit

Permalink
CIF-2948: parse response html in the current browsing context (#955)
Browse files Browse the repository at this point in the history
* CIF-2948: parse response html in the current browsing context

* CIF-2948 - Remove debug console.log

Co-authored-by: Mark J. Becker <herzog31@users.noreply.github.com>
  • Loading branch information
buuhuu and herzog31 authored Sep 9, 2022
1 parent 60cdd75 commit 2dd2b2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ class ProductCollection {

// Parse response and only select product items
let text = await response.text();
let domParser = new DOMParser();
let more = domParser.parseFromString(text, 'text/html');
let more = document.createRange().createContextualFragment(text);
let moreItems = more.querySelectorAll(ProductCollection.selectors.item);

// Append new product items to existing product gallery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ class ProductCollection {

// Parse response and only select product items
let text = await response.text();
let domParser = new DOMParser();
let more = domParser.parseFromString(text, 'text/html');
let more = document.createRange().createContextualFragment(text);
let moreItems = more.querySelectorAll(
ProductCollection.selectors.item + ', ' + ProductCollection.selectors.xfitem
);

console.log('more', more, 'moreItems', moreItems);
// Append new product items to existing product gallery
let galleryItems = this._element.querySelector(ProductCollection.selectors.galleryItems);
galleryItems.append(...moreItems);
Expand Down

0 comments on commit 2dd2b2c

Please sign in to comment.