-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebComponent support - specify where dynamic styles go instead of head #540
Comments
Hey radiolips, Can you please say if this is expected to be fixed? Currently use with polymer is simply impossible. |
Any one got workaround for this ? |
I tried something in case if anyone is interested https://github.com/VinodLouis/polymer-gridstack [adumesny] Note: this code IS NOT BASED on gristack (nor maintained), or is older than 2014. |
@VinodLouis Can you create a PR with changes such that gridstack would work as a web component? |
I use angular component for this lib, and having local to that components styles would be better and might be using webcomponents soon as well. @VinodLouis wish you had done a PR instead of creating a fork off the code! looking at your file you have Note: that gridstack auto-generated CSS files added to the head on 11/25/2014 (for y and height in px) which you don't do |
the offending code is: var Utils = {
createStylesheet: function(id) {
var style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.setAttribute('data-gs-style-id', id);
if (style.styleSheet) {
style.styleSheet.cssText = '';
} else {
style.appendChild(document.createTextNode(''));
}
document.getElementsByTagName('head')[0].appendChild(style);
return style.sheet;
},
removeStylesheet: function(id) {
$('STYLE[data-gs-style-id=' + id + ']').remove();
},
} which can be overridden using: $(function () {
window.GridStackUI.Utils.createStylesheet = function(id) {
//...new code...
};
$('.grid-stack').gridstack();
...
}); |
sorry for taking so long to address. fixed in 0.6.4 |
* insert style before our grid (instead of head) to support webcomponent * fix gridstack#540 * tested on Chrome, FF, Edge, IE11 and all our demos *Note: I didn't have a way to test webcomponent support, but this should do it.
We try to integrate Gridstack in a WebComponent/Polymer environment which means to embed Gridstack in a custom element. We recognized that the dynamically calculated stylesheets for the height of items is added to the
head
node, so the styles are not available inside the shadow DOM of the custom element.In order to enable Gridstack for WebComponents it would be great if Gridstack would be aware of the Shadow DOM and for example allow to provide the DOM root where to place the dynamically created stylesheets.
The text was updated successfully, but these errors were encountered: