Skip to content

Commit

Permalink
fix ie markup render bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rikschennink committed Dec 11, 2019
1 parent 46ec888 commit 87731f8
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog

## 4.8.1

- Fix IE issue where adding markup would not work.


## 4.8.0

- Add `prepareFile` and `prepareFiles` methods to the FilePond instance, use to request output files of the current items in the files list.
Expand Down
2 changes: 1 addition & 1 deletion dist/filepond.css
@@ -1,5 +1,5 @@
/*!
* FilePond 4.8.0
* FilePond 4.8.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down
10 changes: 8 additions & 2 deletions dist/filepond.esm.js
@@ -1,5 +1,5 @@
/*!
* FilePond 4.8.0
* FilePond 4.8.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down Expand Up @@ -188,6 +188,12 @@ const removeChildView = (parent, childViews) => view => {
return view;
};

const testElement = createElement('svg');
const getChildCount =
'children' in testElement
? el => el.children.length
: el => el.childNodes.length;

const getViewRect = (elementRect, childViews, offset, scale) => {
const left = offset[0] || elementRect.left;
const top = offset[1] || elementRect.top;
Expand Down Expand Up @@ -1178,7 +1184,7 @@ const createView =
});

// append created child views to root node
const childCount = element.children.length; // need to know the current child count so appending happens in correct order
const childCount = getChildCount(element); // need to know the current child count so appending happens in correct order
childViews.forEach((child, index) => {
internalAPI.appendChild(child.element, childCount + index);
});
Expand Down
4 changes: 2 additions & 2 deletions dist/filepond.esm.min.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions dist/filepond.js
@@ -1,5 +1,5 @@
/*!
* FilePond 4.8.0
* FilePond 4.8.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
Expand Down Expand Up @@ -230,6 +230,16 @@
};
};

var testElement = createElement('svg');
var getChildCount =
'children' in testElement
? function(el) {
return el.children.length;
}
: function(el) {
return el.childNodes.length;
};

var getViewRect = function getViewRect(
elementRect,
childViews,
Expand Down Expand Up @@ -1361,7 +1371,7 @@
});

// append created child views to root node
var childCount = element.children.length; // need to know the current child count so appending happens in correct order
var childCount = getChildCount(element); // need to know the current child count so appending happens in correct order
childViews.forEach(function(child, index) {
internalAPI.appendChild(child.element, childCount + index);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/filepond.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/filepond.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "filepond",
"version": "4.8.0",
"version": "4.8.1",
"description": "FilePond, Where files go to stretch their bits.",
"license": "MIT",
"author": {
Expand Down
3 changes: 2 additions & 1 deletion src/js/app/frame/createView.js
Expand Up @@ -3,6 +3,7 @@ import { createElement } from './utils/createElement';
import { appendChild } from './utils/appendChild';
import { appendChildView } from './utils/appendChildView';
import { removeChildView } from './utils/removeChildView';
import { getChildCount } from './utils/getChildCount';
import { getViewRect } from './utils/getViewRect';
import { Mixins } from './mixins/index';
import { updateRect } from './utils/updateRect';
Expand Down Expand Up @@ -312,7 +313,7 @@ export const createView =
});

// append created child views to root node
const childCount = element.children.length; // need to know the current child count so appending happens in correct order
const childCount = getChildCount(element); // need to know the current child count so appending happens in correct order
childViews.forEach((child, index) => {
internalAPI.appendChild(child.element, childCount + index);
});
Expand Down
3 changes: 3 additions & 0 deletions src/js/app/frame/utils/getChildCount.js
@@ -0,0 +1,3 @@
import { createElement } from './createElement';
const testElement = createElement('svg');
export const getChildCount = 'children' in testElement ? el => el.children.length : el => el.childNodes.length;

0 comments on commit 87731f8

Please sign in to comment.