Merge pull request #210 from keepassxreboot/ignore_nodes

Ignore nodes which does not contain elements
This commit is contained in:
Janek Bevendorff 2018-07-16 20:38:15 +02:00 committed by GitHub
commit fff55a73d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1219,8 +1219,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 [];
}