wc-context
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -90,3 +90,3 @@ var orphanMap = {}; | ||
function addChildContext(el, name, value) { | ||
function addChildContext(el, name) { | ||
var observerMap = el.__wcContextObserverMap || (el.__wcContextObserverMap = {}); | ||
@@ -98,2 +98,3 @@ var observers = observerMap[name] || (observerMap[name] = []); | ||
var targetEl = event.target; | ||
var value = el.__wcChildContext[name]; | ||
var oldValue = targetEl.__wcContext[name]; | ||
@@ -196,3 +197,3 @@ if (oldValue !== value) { | ||
Object.keys(childContext).forEach(function (key) { | ||
addChildContext(_this2, key, childContext[key]); | ||
addChildContext(_this2, key); | ||
}); | ||
@@ -199,0 +200,0 @@ this.__wcChildContextInitialized = true; |
{ | ||
"name": "wc-context", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Simple context for HTML custom elements", | ||
@@ -5,0 +5,0 @@ "repository": "blikblum/wc-context", |
@@ -86,3 +86,3 @@ const orphanMap = {} | ||
function addChildContext (el, name, value) { | ||
function addChildContext (el, name) { | ||
const observerMap = el.__wcContextObserverMap || (el.__wcContextObserverMap = {}) | ||
@@ -94,2 +94,3 @@ const observers = observerMap[name] || (observerMap[name] = []) | ||
const targetEl = event.target | ||
const value = el.__wcChildContext[name] | ||
const oldValue = targetEl.__wcContext[name] | ||
@@ -96,0 +97,0 @@ if (oldValue !== value) { |
@@ -23,3 +23,3 @@ | ||
Object.keys(childContext).forEach(key => { | ||
addChildContext(this, key, childContext[key]) | ||
addChildContext(this, key) | ||
}) | ||
@@ -26,0 +26,0 @@ this.__wcChildContextInitialized = true |
@@ -41,3 +41,4 @@ /* eslint-env jest */ | ||
defineChildContextProp(grandfatherEl, 'childContext') | ||
addChildContext(grandfatherEl, 'key', 'value') | ||
grandfatherEl.childContext = {key: 'value'} | ||
addChildContext(grandfatherEl, 'key') | ||
}) | ||
@@ -102,3 +103,4 @@ | ||
defineChildContextProp(parentEl, 'childContext') | ||
addChildContext(parentEl, 'key', 'value2') | ||
parentEl.childContext = {key: 'value2'} | ||
addChildContext(parentEl, 'key') | ||
}) | ||
@@ -120,3 +122,4 @@ | ||
defineChildContextProp(parentEl, 'childContext') | ||
addChildContext(parentEl, 'key2', 'value2') | ||
parentEl.childContext = {key2: 'value2'} | ||
addChildContext(parentEl, 'key2') | ||
}) | ||
@@ -138,3 +141,4 @@ | ||
defineChildContextProp(grandfather2El, 'childContext') | ||
addChildContext(grandfather2El, 'key', 'value2') | ||
grandfather2El.childContext = {key: 'value2'} | ||
addChildContext(grandfather2El, 'key') | ||
}) | ||
@@ -195,3 +199,4 @@ | ||
defineChildContextProp(grandfatherEl, 'childContext') | ||
addChildContext(grandfatherEl, 'key', 'value') | ||
grandfatherEl.childContext = {key: 'value'} | ||
addChildContext(grandfatherEl, 'key') | ||
}) | ||
@@ -198,0 +203,0 @@ |
Sorry, the diff of this file is not supported yet
210316
652