can-dom-mutate
Advanced tools
Comparing version 1.3.2 to 1.3.3
19
-util.js
@@ -49,2 +49,6 @@ "use strict"; | ||
function isElementNode (node) { | ||
return !!(node && node.nodeType === 1); | ||
} | ||
function getChildren (parentNode) { | ||
@@ -110,9 +114,18 @@ var nodes = []; | ||
// IE11 requires a filter parameter for createTreeWalker | ||
// it also must be an object with an `acceptNode` property | ||
function treeWalkerFilterFunction() { | ||
return NodeFilter.FILTER_ACCEPT; | ||
} | ||
var treeWalkerFilter = treeWalkerFilterFunction; | ||
treeWalkerFilter.acceptNode = treeWalkerFilterFunction; | ||
function getNodesWithTreeWalker(rootNode) { | ||
var result = isFragment(rootNode) ? [] : [rootNode]; | ||
var walker = getDocument().createTreeWalker( | ||
// IE11 throws if createTreeWalker is called on a non-ElementNode | ||
var walker = isElementNode(rootNode) && getDocument().createTreeWalker( | ||
rootNode, | ||
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, | ||
null, | ||
treeWalkerFilter, | ||
false | ||
@@ -122,3 +135,3 @@ ); | ||
var node; | ||
while(node = walker.nextNode()) { | ||
while(node = walker && walker.nextNode()) { | ||
result.push(node); | ||
@@ -125,0 +138,0 @@ } |
{ | ||
"name": "can-dom-mutate", | ||
"description": "Dispatch and listen for DOM mutations", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "DoneJS Team", |
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
59404
1356