This commit is contained in:
carson 2020-05-07 11:55:09 -07:00
parent 760f949114
commit 2c91eb1b47
2 changed files with 27 additions and 21 deletions

View File

@ -528,8 +528,10 @@ var kutty = kutty || (function () {
processClassList(elt, removeClass, "remove");
}
}
if (elt.children) { // IE
forEach(elt.children, function(child) { processNode(child) });
}
}
//====================================================================
// Event/Log Support

View File

@ -104,10 +104,12 @@ var kutty = kutty || (function () {
}
function forEach(arr, func) {
if (arr) {
for (var i = 0; i < arr.length; i++) {
func(arr[i]);
}
}
}
function isScrolledIntoView(el) {
var rect = el.getBoundingClientRect();
@ -164,15 +166,15 @@ var kutty = kutty || (function () {
if (getAttributeValue(child, "kt-swap-oob") === "true") {
var target = getDocument().getElementById(child.id);
if (target) {
var fragment = new DocumentFragment()
fragment.append(child);
var fragment = getDocument().createDocumentFragment();
fragment.appendChild(child);
settleTasks = settleTasks.concat(swapOuterHTML(target, fragment));
} else {
child.parentNode.removeChild(child);
triggerEvent(getDocument().body, "oobErrorNoTarget.kutty", {id: child.id, content: child})
}
}
})
});
return settleTasks;
}
@ -245,9 +247,9 @@ var kutty = kutty || (function () {
function maybeSelectFromResponse(elt, fragment) {
var selector = getClosestAttributeValue(elt, "kt-select");
if (selector) {
var newFragment = new DocumentFragment();
var newFragment = getDocument().createDocumentFragment();
forEach(fragment.querySelectorAll(selector), function (node) {
newFragment.append(node);
newFragment.appendChild(node);
});
fragment = newFragment;
}
@ -256,6 +258,7 @@ var kutty = kutty || (function () {
function swapResponse(target, elt, responseText) {
var fragment = makeFragment(responseText);
if (fragment) {
var settleTasks = handleOutOfBandSwaps(fragment);
fragment = maybeSelectFromResponse(elt, fragment);
@ -270,6 +273,7 @@ var kutty = kutty || (function () {
default: return concat(settleTasks, swapInnerHTML(target, fragment));
}
}
}
function handleTrigger(elt, trigger) {
if (trigger) {
@ -524,7 +528,7 @@ var kutty = kutty || (function () {
processClassList(elt, removeClass, "remove");
}
}
if(elt.children) {
if (elt.children) { // IE
forEach(elt.children, function(child) { processNode(child) });
}
}