Comparing version 10.5.0 to 10.6.0
@@ -7,6 +7,7 @@ import objectReduce from 'fast-loops/lib/objectReduce'; | ||
support = _ref.support; | ||
var targetDocument = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document; | ||
var head = document.head || {}; | ||
var head = targetDocument.head || {}; | ||
var node = document.createElement('style'); | ||
var node = targetDocument.createElement('style'); | ||
node.setAttribute('data-fela-type', type); | ||
@@ -13,0 +14,0 @@ node.type = 'text/css'; |
@@ -10,2 +10,4 @@ | ||
export default function createSubscription(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return function (change) { | ||
@@ -23,3 +25,3 @@ if (change.type === CLEAR_TYPE) { | ||
var node = getNodeFromCache(change, renderer); | ||
var node = getNodeFromCache(change, renderer, targetDocument); | ||
@@ -26,0 +28,0 @@ switch (change.type) { |
@@ -16,2 +16,4 @@ import calculateNodeScore from './calculateNodeScore'; | ||
export default function getNodeFromCache(attributes, renderer) { | ||
var targetDocument = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; | ||
var reference = getReference(attributes); | ||
@@ -21,3 +23,3 @@ | ||
var score = calculateNodeScore(attributes, renderer.mediaQueryOrder); | ||
var node = queryNode(attributes) || createNode(renderer.nodes, score, attributes); | ||
var node = queryNode(attributes, targetDocument) || createNode(renderer.nodes, score, attributes, targetDocument); | ||
@@ -24,0 +26,0 @@ renderer.nodes[reference] = { |
@@ -7,3 +7,3 @@ | ||
support = _ref.support; | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
@@ -13,3 +13,3 @@ var mediaQuery = media ? '[media="' + media + '"]' : ':not([media])'; | ||
return document.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
return targetDocument.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
} |
@@ -15,5 +15,7 @@ import arrayEach from 'fast-loops/lib/arrayEach'; | ||
export default function rehydrate(renderer) { | ||
render(renderer); | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
arrayEach(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
render(renderer, targetDocument); | ||
arrayEach(targetDocument.querySelectorAll('[data-fela-type]'), function (node) { | ||
var rehydrationAttribute = node.getAttribute('data-fela-rehydration') || -1; | ||
@@ -20,0 +22,0 @@ var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); |
@@ -5,3 +5,3 @@ import objectEach from 'fast-loops/lib/objectEach'; | ||
export default function render(renderer) { | ||
export default function render(renderer, targetDocument) { | ||
if (!renderer.updateSubscription) { | ||
@@ -11,3 +11,3 @@ renderer.scoreIndex = {}; | ||
renderer.updateSubscription = createSubscription(renderer); | ||
renderer.updateSubscription = createSubscription(renderer, targetDocument); | ||
renderer.subscribe(renderer.updateSubscription); | ||
@@ -14,0 +14,0 @@ |
@@ -18,6 +18,7 @@ 'use strict'; | ||
support = _ref.support; | ||
var targetDocument = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document; | ||
var head = document.head || {}; | ||
var head = targetDocument.head || {}; | ||
var node = document.createElement('style'); | ||
var node = targetDocument.createElement('style'); | ||
node.setAttribute('data-fela-type', type); | ||
@@ -24,0 +25,0 @@ node.type = 'text/css'; |
@@ -26,2 +26,4 @@ 'use strict'; | ||
function createSubscription(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return function (change) { | ||
@@ -39,3 +41,3 @@ if (change.type === _felaUtils.CLEAR_TYPE) { | ||
var node = (0, _getNodeFromCache2.default)(change, renderer); | ||
var node = (0, _getNodeFromCache2.default)(change, renderer, targetDocument); | ||
@@ -42,0 +44,0 @@ switch (change.type) { |
@@ -32,2 +32,4 @@ 'use strict'; | ||
function getNodeFromCache(attributes, renderer) { | ||
var targetDocument = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; | ||
var reference = getReference(attributes); | ||
@@ -37,3 +39,3 @@ | ||
var score = (0, _calculateNodeScore2.default)(attributes, renderer.mediaQueryOrder); | ||
var node = (0, _queryNode2.default)(attributes) || (0, _createNode2.default)(renderer.nodes, score, attributes); | ||
var node = (0, _queryNode2.default)(attributes, targetDocument) || (0, _createNode2.default)(renderer.nodes, score, attributes, targetDocument); | ||
@@ -40,0 +42,0 @@ renderer.nodes[reference] = { |
@@ -11,3 +11,3 @@ 'use strict'; | ||
support = _ref.support; | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
@@ -17,3 +17,3 @@ var mediaQuery = media ? '[media="' + media + '"]' : ':not([media])'; | ||
return document.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
return targetDocument.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
} |
@@ -37,5 +37,7 @@ 'use strict'; | ||
function rehydrate(renderer) { | ||
(0, _render2.default)(renderer); | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
(0, _arrayEach2.default)(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
(0, _render2.default)(renderer, targetDocument); | ||
(0, _arrayEach2.default)(targetDocument.querySelectorAll('[data-fela-type]'), function (node) { | ||
var rehydrationAttribute = node.getAttribute('data-fela-rehydration') || -1; | ||
@@ -42,0 +44,0 @@ var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); |
@@ -18,3 +18,3 @@ 'use strict'; | ||
function render(renderer) { | ||
function render(renderer, targetDocument) { | ||
if (!renderer.updateSubscription) { | ||
@@ -24,3 +24,3 @@ renderer.scoreIndex = {}; | ||
renderer.updateSubscription = (0, _createSubscription2.default)(renderer); | ||
renderer.updateSubscription = (0, _createSubscription2.default)(renderer, targetDocument); | ||
renderer.subscribe(renderer.updateSubscription); | ||
@@ -27,0 +27,0 @@ |
{ | ||
"name": "fela-dom", | ||
"version": "10.5.0", | ||
"version": "10.6.0", | ||
"description": "Fela package for working with the DOM", | ||
@@ -29,10 +29,10 @@ "main": "lib/index.js", | ||
"fast-loops": "^1.0.1", | ||
"fela-utils": "^10.5.0" | ||
"fela-utils": "^10.6.0" | ||
}, | ||
"devDependencies": { | ||
"fela": "^10.5.0", | ||
"fela-preset-web": "^10.5.0", | ||
"fela-tools": "^10.5.0" | ||
"fela": "^10.6.0", | ||
"fela-preset-web": "^10.6.0", | ||
"fela-tools": "^10.6.0" | ||
}, | ||
"gitHead": "7df4025165beea5f1ea0bb3d75d524e59f4a400f" | ||
"gitHead": "6b4359bccbd38ddf7834204cc03ac98c2efa605d" | ||
} |
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
51304
1090
52925
Updatedfela-utils@^10.6.0