🐛 Fixed images on infinite scroll index pages being stretched in Safari (#636)
closes #634, closes #635 - use `document.importNode` to create a clone of post card elements when pulling them in from infinite scroll pages - cloning the element means the element's owner document matches the viewed document and ensures images in the inserted post card elements are sized according to the viewed document
This commit is contained in:
parent
17ba4add5c
commit
307c334cd5
2 changed files with 5 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,10 @@
|
||||||
// append contents
|
// append contents
|
||||||
var postElements = this.response.querySelectorAll('.post-card');
|
var postElements = this.response.querySelectorAll('.post-card');
|
||||||
postElements.forEach(function (item) {
|
postElements.forEach(function (item) {
|
||||||
feedElement.appendChild(item);
|
// document.importNode is important, without it the item's owner
|
||||||
|
// document will be different which can break resizing of
|
||||||
|
// `object-fit: cover` images in Safari
|
||||||
|
feedElement.appendChild(document.importNode(item, true));
|
||||||
});
|
});
|
||||||
|
|
||||||
// set next link
|
// set next link
|
||||||
|
|
Loading…
Reference in a new issue