You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an empty div on which I've initialized Masonry, but the following line causes a javascript error when the div contains 0 elements matching itemSelector:
var firstItemElem = this.items[0].element;
in the function Masonry.prototype.measureColumns
If the columnWidth value is present, there is no need to check the width of the first element. If columnWidth is not present and there are no elements in the container, it would be okay to either throw an error, automatically set some arbitrary width, or wait until an item is added to determine the width.
Fixing this bug would allow me to have an empty Masonry container in which I can insert elements at a later time. For now, I must create a dummy element and then remove it by javascript after Masonry is initialized.
For anyone getting the error: "Uncaught TypeError: Cannot read property 'element' of undefined" this may be related to your issue.
The text was updated successfully, but these errors were encountered:
I have an empty div on which I've initialized Masonry, but the following line causes a javascript error when the div contains 0 elements matching itemSelector:
var firstItemElem = this.items[0].element;
in the function Masonry.prototype.measureColumns
If the columnWidth value is present, there is no need to check the width of the first element. If columnWidth is not present and there are no elements in the container, it would be okay to either throw an error, automatically set some arbitrary width, or wait until an item is added to determine the width.
Fixing this bug would allow me to have an empty Masonry container in which I can insert elements at a later time. For now, I must create a dummy element and then remove it by javascript after Masonry is initialized.
For anyone getting the error: "Uncaught TypeError: Cannot read property 'element' of undefined" this may be related to your issue.
The text was updated successfully, but these errors were encountered: