@emotion/cache
Advanced tools
Comparing version
# @emotion/cache | ||
## 11.0.0-next.19 | ||
### Patch Changes | ||
- [`42df3f3b`](https://github.com/emotion-js/emotion/commit/42df3f3bc01526eed61cedba106d86b9e3807f9d) [#2028](https://github.com/emotion-js/emotion/pull/2028) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with Emotion messing up style elements already processed by previously initialized Emotion copy. | ||
- Updated dependencies [[`42df3f3b`](https://github.com/emotion-js/emotion/commit/42df3f3bc01526eed61cedba106d86b9e3807f9d)]: | ||
- @emotion/sheet@1.0.0-next.5 | ||
## 11.0.0-next.18 | ||
@@ -4,0 +13,0 @@ |
@@ -179,3 +179,2 @@ 'use strict'; | ||
var defaultStylisPlugins = [stylis.prefixer]; | ||
var movedStyles = false; | ||
@@ -189,5 +188,4 @@ var createCache = function createCache(options) { | ||
if ( !movedStyles && key === 'css') { | ||
movedStyles = true; | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]"); // get SSRed styles out of the way of React's hydration | ||
if ( key === 'css') { | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration | ||
// document.head is a safe place to move them to | ||
@@ -197,2 +195,3 @@ | ||
document.head.appendChild(node); | ||
node.setAttribute('data-s', ''); | ||
}); | ||
@@ -199,0 +198,0 @@ } |
@@ -175,3 +175,2 @@ import { StyleSheet } from '@emotion/sheet'; | ||
var defaultStylisPlugins = [prefixer]; | ||
var movedStyles = false; | ||
@@ -185,5 +184,4 @@ var createCache = function createCache(options) { | ||
if ( !movedStyles && key === 'css') { | ||
movedStyles = true; | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]"); // get SSRed styles out of the way of React's hydration | ||
if ( key === 'css') { | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration | ||
// document.head is a safe place to move them to | ||
@@ -193,2 +191,3 @@ | ||
document.head.appendChild(node); | ||
node.setAttribute('data-s', ''); | ||
}); | ||
@@ -195,0 +194,0 @@ } |
@@ -193,3 +193,2 @@ 'use strict'; | ||
var defaultStylisPlugins = [stylis.prefixer]; | ||
var movedStyles = false; | ||
@@ -203,5 +202,4 @@ var createCache = function createCache(options) { | ||
if (isBrowser && !movedStyles && key === 'css') { | ||
movedStyles = true; | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]"); // get SSRed styles out of the way of React's hydration | ||
if (isBrowser && key === 'css') { | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration | ||
// document.head is a safe place to move them to | ||
@@ -211,2 +209,3 @@ | ||
document.head.appendChild(node); | ||
node.setAttribute('data-s', ''); | ||
}); | ||
@@ -213,0 +212,0 @@ } |
@@ -62,10 +62,9 @@ "use strict"; | ||
})); | ||
})), defaultStylisPlugins = [ stylis.prefixer ], movedStyles = !1, createCache = function(options) { | ||
})), defaultStylisPlugins = [ stylis.prefixer ], createCache = function(options) { | ||
var key = options.key; | ||
if (!key) throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\nIf multiple caches share the same key they might \"fight\" for each other's style elements."); | ||
if (isBrowser && !movedStyles && "css" === key) { | ||
movedStyles = !0; | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]"); | ||
if (isBrowser && "css" === key) { | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); | ||
Array.prototype.forEach.call(ssrStyles, (function(node) { | ||
document.head.appendChild(node); | ||
document.head.appendChild(node), node.setAttribute("data-s", ""); | ||
})); | ||
@@ -72,0 +71,0 @@ } |
@@ -184,3 +184,2 @@ import { StyleSheet } from '@emotion/sheet'; | ||
var defaultStylisPlugins = [prefixer]; | ||
var movedStyles = false; | ||
@@ -194,5 +193,4 @@ var createCache = function createCache(options) { | ||
if (isBrowser && !movedStyles && key === 'css') { | ||
movedStyles = true; | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]"); // get SSRed styles out of the way of React's hydration | ||
if (isBrowser && key === 'css') { | ||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration | ||
// document.head is a safe place to move them to | ||
@@ -202,2 +200,3 @@ | ||
document.head.appendChild(node); | ||
node.setAttribute('data-s', ''); | ||
}); | ||
@@ -204,0 +203,0 @@ } |
{ | ||
"name": "@emotion/cache", | ||
"version": "11.0.0-next.18", | ||
"version": "11.0.0-next.19", | ||
"description": "emotion's cache", | ||
@@ -19,3 +19,3 @@ "main": "dist/cache.cjs.js", | ||
"@emotion/memoize": "^0.7.4", | ||
"@emotion/sheet": "1.0.0-next.4", | ||
"@emotion/sheet": "1.0.0-next.5", | ||
"@emotion/utils": "1.0.0-next.1", | ||
@@ -22,0 +22,0 @@ "@emotion/weak-memoize": "0.2.5", |
@@ -44,3 +44,2 @@ // @flow | ||
const defaultStylisPlugins = [prefixer] | ||
let movedStyles = false | ||
@@ -57,6 +56,6 @@ let createCache = (options: Options): EmotionCache => { | ||
if (isBrowser && !movedStyles && key === 'css') { | ||
movedStyles = true | ||
const ssrStyles = document.querySelectorAll(`style[data-emotion]`) | ||
if (isBrowser && key === 'css') { | ||
const ssrStyles = document.querySelectorAll( | ||
`style[data-emotion]:not([data-s])` | ||
) | ||
// get SSRed styles out of the way of React's hydration | ||
@@ -66,2 +65,3 @@ // document.head is a safe place to move them to | ||
;((document.head: any): HTMLHeadElement).appendChild(node) | ||
node.setAttribute('data-s', '') | ||
}) | ||
@@ -68,0 +68,0 @@ } |
76279
0.61%1634
-0.24%+ Added
- Removed
Updated