aurelia-ui-toolkits / aurelia-materialize-bridge

Materialize CSS components for Aurelia
http://aurelia-ui-toolkits.github.io/demo-materialize/
MIT License
155 stars 53 forks source link

Polyfills break server-side rendering #538

Closed Vheissu closed 5 years ago

Vheissu commented 5 years ago

When using Aurelia Materialize Bridge, two included polyfills break the application. The polyfills in question are: remove and append.

In the case of append the document object does not exist because it's a server environment, so it complains about Document not being defined. To fix this temporarily, I've had to edit the compiled source file append.js to the following:

})(typeof Document !== 'undefined' ? [Element.prototype, Document.prototype, DocumentFragment.prototype] : []);

And in the remove compiled file, Text is not defined (server once again). So I had to edit the compiled file and add in the following:

    if (typeof Text !== 'undefined' && Text && !Text.prototype.remove) {
        Text.prototype.remove = remove;
    }
MaximBalaganskiy commented 5 years ago

Fixed via a851e9548a011f5fc3bd7718af05c427520b25e9