@emotion/sheet
Advanced tools
Comparing version 1.0.0-next.3 to 1.0.0-next.4
# @emotion/sheet | ||
## 1.0.0-next.4 | ||
### Patch Changes | ||
- [`39be057b`](https://github.com/emotion-js/emotion/commit/39be057b1a0c6b76f2cb7a455cb8bc35fe875ba0) [#1997](https://github.com/emotion-js/emotion/pull/1997) Thanks [@Andarist](https://github.com/Andarist)! - Reverted the change that has started to add an empty `<style/>` element eagerly in non-production environments that has been introduced in [`v1.0.0-next.3`](https://github.com/emotion-js/emotion/blob/next/packages/sheet/CHANGELOG.md#100-next3) as this has found to be problematic for websites using `Content-Security-Policy` and a `nonce`. Instead of this `@emotion/cache` will from now on insert an empty rule in non-production environments but it will only do that if an empty rule gets actually created by the user. | ||
## 1.0.0-next.3 | ||
@@ -4,0 +10,0 @@ |
@@ -45,4 +45,2 @@ 'use strict'; | ||
var isBrowser = "object" !== 'undefined'; | ||
function createStyleElement(options) { | ||
@@ -86,19 +84,3 @@ var tag = document.createElement('style'); | ||
this.prepend = options.prepend; | ||
this.before = null; // insert a single empty style eagerly in dev | ||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet | ||
if (process.env.NODE_ENV !== 'production' && isBrowser) { | ||
var tag = createStyleElement(this); | ||
if (this.isSpeedy) { | ||
// avoid extra style tag in speedy mode | ||
// it's a harmless hack to make `this.insert` grab this tag created here instead of creating a new one | ||
this.ctr++; | ||
} else { | ||
// non-speedy styles won't be reused, add this just for informational purposes and less surprising snapshots | ||
tag.setAttribute('data-eager-key', 'true'); | ||
} | ||
this._insertTag(tag); | ||
} | ||
this.before = null; | ||
} | ||
@@ -105,0 +87,0 @@ |
@@ -41,4 +41,2 @@ /* | ||
var isBrowser = "object" !== 'undefined'; | ||
function createStyleElement(options) { | ||
@@ -82,19 +80,3 @@ var tag = document.createElement('style'); | ||
this.prepend = options.prepend; | ||
this.before = null; // insert a single empty style eagerly in dev | ||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet | ||
if (process.env.NODE_ENV !== 'production' && isBrowser) { | ||
var tag = createStyleElement(this); | ||
if (this.isSpeedy) { | ||
// avoid extra style tag in speedy mode | ||
// it's a harmless hack to make `this.insert` grab this tag created here instead of creating a new one | ||
this.ctr++; | ||
} else { | ||
// non-speedy styles won't be reused, add this just for informational purposes and less surprising snapshots | ||
tag.setAttribute('data-eager-key', 'true'); | ||
} | ||
this._insertTag(tag); | ||
} | ||
this.before = null; | ||
} | ||
@@ -101,0 +83,0 @@ |
@@ -45,4 +45,2 @@ 'use strict'; | ||
var isBrowser = typeof document !== 'undefined'; | ||
function createStyleElement(options) { | ||
@@ -86,19 +84,3 @@ var tag = document.createElement('style'); | ||
this.prepend = options.prepend; | ||
this.before = null; // insert a single empty style eagerly in dev | ||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet | ||
if (process.env.NODE_ENV !== 'production' && isBrowser) { | ||
var tag = createStyleElement(this); | ||
if (this.isSpeedy) { | ||
// avoid extra style tag in speedy mode | ||
// it's a harmless hack to make `this.insert` grab this tag created here instead of creating a new one | ||
this.ctr++; | ||
} else { | ||
// non-speedy styles won't be reused, add this just for informational purposes and less surprising snapshots | ||
tag.setAttribute('data-eager-key', 'true'); | ||
} | ||
this._insertTag(tag); | ||
} | ||
this.before = null; | ||
} | ||
@@ -105,0 +87,0 @@ |
@@ -41,4 +41,2 @@ /* | ||
var isBrowser = typeof document !== 'undefined'; | ||
function createStyleElement(options) { | ||
@@ -82,19 +80,3 @@ var tag = document.createElement('style'); | ||
this.prepend = options.prepend; | ||
this.before = null; // insert a single empty style eagerly in dev | ||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet | ||
if (process.env.NODE_ENV !== 'production' && isBrowser) { | ||
var tag = createStyleElement(this); | ||
if (this.isSpeedy) { | ||
// avoid extra style tag in speedy mode | ||
// it's a harmless hack to make `this.insert` grab this tag created here instead of creating a new one | ||
this.ctr++; | ||
} else { | ||
// non-speedy styles won't be reused, add this just for informational purposes and less surprising snapshots | ||
tag.setAttribute('data-eager-key', 'true'); | ||
} | ||
this._insertTag(tag); | ||
} | ||
this.before = null; | ||
} | ||
@@ -101,0 +83,0 @@ |
{ | ||
"name": "@emotion/sheet", | ||
"version": "1.0.0-next.3", | ||
"version": "1.0.0-next.4", | ||
"description": "emotion's stylesheet", | ||
@@ -5,0 +5,0 @@ "main": "dist/sheet.cjs.js", |
@@ -50,4 +50,2 @@ // @flow | ||
let isBrowser = typeof document !== 'undefined' | ||
function createStyleElement(options: { | ||
@@ -88,18 +86,2 @@ key: string, | ||
this.before = null | ||
// insert a single empty style eagerly in dev | ||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet | ||
if (process.env.NODE_ENV !== 'production' && isBrowser) { | ||
const tag = createStyleElement(this) | ||
if (this.isSpeedy) { | ||
// avoid extra style tag in speedy mode | ||
// it's a harmless hack to make `this.insert` grab this tag created here instead of creating a new one | ||
this.ctr++ | ||
} else { | ||
// non-speedy styles won't be reused, add this just for informational purposes and less surprising snapshots | ||
tag.setAttribute('data-eager-key', 'true') | ||
} | ||
this._insertTag(tag) | ||
} | ||
} | ||
@@ -106,0 +88,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32776
653