Ignore nodes which does not contain elements

This commit is contained in:
varjolintu 2018-06-19 14:39:20 +03:00
parent 6ba29a70f2
commit 92cde01e03

View file

@ -1208,8 +1208,22 @@ cipObserverHelper.inputTypes = [
null // Input field can be without any type. Include these to the list.
];
// Ignores all nodes that doesn't contain elements
cipObserverHelper.ignoredNode = function(target) {
if (target.nodeType === Node.ATTRIBUTE_NODE ||
target.nodeType === Node.TEXT_NODE ||
target.nodeType === Node.CDATA_SECTION_NODE ||
target.nodeType === Node.PROCESSING_INSTRUCTION_NODE ||
target.nodeType === Node.COMMENT_NODE ||
target.nodeType === Node.DOCUMENT_TYPE_NODE ||
target.nodeType === Node.NOTATION_NODE) {
return true;
}
return false;
};
cipObserverHelper.getInputs = function(target) {
if (target.nodeType === Node.TEXT_NODE || target.nodeType === Node.COMMENT_NODE) {
if (cipObserverHelper.ignoredNode(target)) {
return [];
}