Thanks to visit codestin.com
Credit goes to github.com

Skip to content

adding styleInHead option #1313

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

Merged
merged 5 commits into from
Jul 30, 2020
Merged

adding styleInHead option #1313

merged 5 commits into from
Jul 30, 2020

Conversation

gregid
Copy link
Contributor

@gregid gregid commented Jul 30, 2020

Description

This change allows for keeping older behavior of gridstack where <STYLE> was added to <HEAD> instead of parentNode. The default behavior remains to be to use parentNode but in situations where head is preferrable just pass styleInHead = true to gridstack options.

Checklist

  • Created tests which fail without the change (if possible)
  • Newly added tests are passing. There is one test that is currently failing on gridstack.js/develop though
  • Extended the README / documentation, if necessary

src/gridstack.js Outdated
@@ -1092,8 +1093,9 @@
Utils.removeStylesheet(this._stylesId);
}
this._stylesId = 'gridstack-style-' + (Math.random() * 100000).toFixed();
// insert style to parent (instead of 'head') to support WebComponent
this._styles = Utils.createStylesheet(this._stylesId, this.el.parentNode);
var styleLocation = this.opts.styleInHead ? false : this.el.parentNode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use null or undefined instead since parent is an element pointer (issue in typescript version) but works here in JS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to undefined

@adumesny adumesny merged commit 621a239 into gridstack:develop Jul 30, 2020
@adumesny
Copy link
Member

thank you for contributing - great job at documenting and testing this. I can make a new release soon if nothing else comes up..
I'll push your changes to 2.x typescript branch as well.

adumesny added a commit to adumesny/gridstack.js that referenced this pull request Jul 30, 2020
adumesny added a commit that referenced this pull request Jul 30, 2020
typedef for #1313 styleInHead option
adumesny added a commit to adumesny/gridstack.js that referenced this pull request Jul 31, 2020
adumesny added a commit that referenced this pull request Jul 31, 2020
TS: adding styleInHead option for  #1313
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants