Skip to content

Commit

Permalink
Merge pull request #121 from canjs/ie11-compat
Browse files Browse the repository at this point in the history
Ie11 compat
  • Loading branch information
thomaswilburn authored Sep 7, 2018
2 parents 20b575c + d5b1664 commit cca54c3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion lib/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ live.attr = function(el, attributeName, compute) {
// register that the handler changes the parent element
canReflect.assignSymbols(liveUpdateAttr, {
"can.getChangesDependencyRecord": function() {
var s = new Set();
s.add(el);
return {
valueDependencies: new Set( [ el ] )
valueDependencies: s
};
}
});
Expand Down
6 changes: 4 additions & 2 deletions lib/attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ live.attrs = function(el, compute, scope, options) {
// register that the handler changes the parent element
canReflect.assignSymbols(liveAttrsUpdate, {
"can.getChangesDependencyRecord": function() {
var s = new Set();
s.add(el);
return {
valueDependencies: new Set( [ el ] )
valueDependencies: s
};
}
});
Expand Down Expand Up @@ -97,7 +99,7 @@ live.attrs = function(el, compute, scope, options) {
};
// unbind on element removal
removalDisposal = domMutate.onNodeRemoval(el, function () {
if (!el.ownerDocument.contains(el)) {
if (!el.ownerDocument.documentElement.contains(el)) {
teardownHandler();
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var live = {
}
};
removalDisposal = domMutate.onNodeRemoval(el, function () {
if (!el.ownerDocument.contains(el)) {
if (!el.ownerDocument.documentElement.contains(el)) {
teardown();
}
});
Expand Down
4 changes: 3 additions & 1 deletion lib/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ live.html = function(el, compute, parentNode, nodeListOrOptions) {
// register that the handler changes the parent element
canReflect.assignSymbols(liveHTMLUpdateHTML, {
"can.getChangesDependencyRecord": function() {
var s = new Set();
s.add(parentNode);
return {
valueDependencies: new Set( [ parentNode ] )
valueDependencies: s
};
}
});
Expand Down
4 changes: 3 additions & 1 deletion lib/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ live.text = function(el, compute, parentNode, nodeList) {
// register that the handler changes the parent element
canReflect.assignSymbols(liveTextUpdateTextNode, {
"can.getChangesDependencyRecord": function() {
var s = new Set();
s.add(parent);
return {
valueDependencies: new Set( [ parent ] )
valueDependencies: s
};
}
});
Expand Down
10 changes: 5 additions & 5 deletions test/html-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ test("html live binding handles objects with can.viewInsert symbol", 2, function
div.appendChild(placeholder);

var html = new Observation(function() {
return {
[canSymbol.for("can.viewInsert")]: function() {
assert.equal(arguments[0], options, "options were passed to symbol function");
return document.createTextNode("Replaced text");
}
var d = {};
d[canSymbol.for("can.viewInsert")] = function() {
assert.equal(arguments[0], options, "options were passed to symbol function");
return document.createTextNode("Replaced text");
};
return d;
});

live.html(placeholder, html, div, options);
Expand Down

0 comments on commit cca54c3

Please sign in to comment.