mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2324 from keepassxreboot/fix/nodename_check
Fix nodeName check
This commit is contained in:
commit
17a5fa5f45
7 changed files with 17 additions and 17 deletions
|
|
@ -102,7 +102,7 @@ kpxcSites.exceptionFound = function(identifier, field) {
|
|||
* @returns {boolean} True if an Element has a match with the needed indentfifiers and document location
|
||||
*/
|
||||
kpxcSites.totpExceptionFound = function(field) {
|
||||
if (!field || !matchesWithNodeName(field.nodeName, 'INPUT')) {
|
||||
if (!field || !matchesWithNodeName(field, 'INPUT')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ kpxcSites.totpExceptionFound = function(field) {
|
|||
* @returns {boolean} True if an Element has a match with the needed indentfifiers and document location
|
||||
*/
|
||||
kpxcSites.segmentedTotpExceptionFound = function(form) {
|
||||
if (!form || !matchesWithNodeName(form.nodeName, 'FORM')) {
|
||||
if (!form || !matchesWithNodeName(form, 'FORM')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) {
|
|||
const addTotpFieldsToCombination = function(inputFields, ignoreFieldCount = false) {
|
||||
const totpInputs = Array.from(inputFields).filter(
|
||||
(e) =>
|
||||
matchesWithNodeName(e.nodeName, 'INPUT') &&
|
||||
matchesWithNodeName(e, 'INPUT') &&
|
||||
e.type !== 'password' &&
|
||||
e.type !== 'hidden' &&
|
||||
e.type !== 'submit'
|
||||
|
|
@ -155,8 +155,8 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) {
|
|||
// 7 inputs with a button as the last one (e.g. PayPal uses this)
|
||||
if (
|
||||
currentForm.length === 7 &&
|
||||
(matchesWithNodeName(currentForm.lastChild.nodeName, 'BUTTON') ||
|
||||
(matchesWithNodeName(currentForm.lastChild.nodeName, 'INPUT') &&
|
||||
(matchesWithNodeName(currentForm.lastChild, 'BUTTON') ||
|
||||
(matchesWithNodeName(currentForm.lastChild, 'INPUT') &&
|
||||
currentForm.lastChild.type === 'button'))
|
||||
) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ kpxcFill.fillInCredentials = async function(combination, predefinedUsername, uui
|
|||
}
|
||||
|
||||
// Fill password
|
||||
if (combination.password && matchesWithNodeName(combination.password.nodeName, 'INPUT')) {
|
||||
if (combination.password && matchesWithNodeName(combination.password, 'INPUT')) {
|
||||
// Show a notification if password length exceeds the length defined in input
|
||||
if (combination.password.maxLength
|
||||
&& combination.password.maxLength > 0
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ kpxcForm.getFormSubmitButton = function(form) {
|
|||
|
||||
// Try to find similar buttons outside the form which are added via 'form' property
|
||||
for (const e of form.elements) {
|
||||
if ((matchesWithNodeName(e.nodeName, 'BUTTON') && (e.type === 'button' || e.type === 'submit' || e.type === ''))
|
||||
|| (matchesWithNodeName(e.nodeName, 'INPUT') && (e.type === 'button' || e.type === 'submit'))) {
|
||||
if ((matchesWithNodeName(e, 'BUTTON') && (e.type === 'button' || e.type === 'submit' || e.type === ''))
|
||||
|| (matchesWithNodeName(e, 'INPUT') && (e.type === 'button' || e.type === 'submit'))) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,13 +127,13 @@ kpxcForm.onSubmit = async function(e) {
|
|||
kpxcForm.submitTriggered = true;
|
||||
|
||||
const searchForm = f => {
|
||||
if (matchesWithNodeName(f.nodeName, 'FORM')) {
|
||||
if (matchesWithNodeName(f, 'FORM')) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
||||
// Traverse parents if the form is not found.
|
||||
let form = matchesWithNodeName(this.nodeName, 'FORM')
|
||||
let form = matchesWithNodeName(this, 'FORM')
|
||||
? this
|
||||
: kpxcFields.traverseParents(this, searchForm, searchForm, () => null);
|
||||
|
||||
|
|
@ -207,10 +207,10 @@ kpxcForm.saveForm = function(form, combination) {
|
|||
password: combination.password,
|
||||
totp: combination.totp,
|
||||
totpInputs: Array.from(form.elements).filter(
|
||||
e => matchesWithNodeName(e.nodeName, 'INPUT') && kpxcTOTPIcons.isValid(e),
|
||||
e => matchesWithNodeName(e, 'INPUT') && kpxcTOTPIcons.isValid(e),
|
||||
),
|
||||
passwordInputs: Array.from(form.elements).filter(
|
||||
e => matchesWithNodeName(e.nodeName, 'INPUT') && e.type === 'password',
|
||||
e => matchesWithNodeName(e, 'INPUT') && e.type === 'password',
|
||||
)
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ kpxc.rememberCredentialsFromContextMenu = async function() {
|
|||
}
|
||||
|
||||
const el = document.activeElement;
|
||||
if (!matchesWithNodeName(el.nodeName, 'INPUT')) {
|
||||
if (!matchesWithNodeName(el, 'INPUT')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ kpxcObserverHelper.initObserver = async function() {
|
|||
}
|
||||
} else if (mut.type === 'attributes' && (mut.attributeName === 'class' || mut.attributeName === 'style')) {
|
||||
// Only accept targets with forms
|
||||
const forms = matchesWithNodeName(mut.target.nodeName, 'FORM') ? mut.target : mut.target.getElementsByTagName('form');
|
||||
const forms = matchesWithNodeName(mut.target, 'FORM') ? mut.target : mut.target.getElementsByTagName('form');
|
||||
if (forms.length === 0 && !kpxcSites.exceptionFound(mut.target.classList, mut.target)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ kpxcObserverHelper.getInputs = function(target, ignoreVisibility = false) {
|
|||
}
|
||||
});
|
||||
|
||||
if (matchesWithNodeName(target.nodeName, 'INPUT')) {
|
||||
if (matchesWithNodeName(target, 'INPUT')) {
|
||||
inputFields.push(target);
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ const traverseChildren = function(target, inputFields, depth = 1) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (matchesWithNodeName(child.nodeName, 'INPUT')) {
|
||||
if (matchesWithNodeName(child, 'INPUT')) {
|
||||
inputFields.push(child);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ kpxcUI.monitorIconPosition = function(iconClass) {
|
|||
});
|
||||
|
||||
window.addEventListener('transitionend', function(e) {
|
||||
if (matchesWithNodeName(e.target?.nodeName, 'INPUT') || matchesWithNodeName(e.target?.nodeName, 'TEXTAREA')) {
|
||||
if (matchesWithNodeName(e.target, 'INPUT') || matchesWithNodeName(e.target, 'TEXTAREA')) {
|
||||
kpxcUI.updateIconPosition(iconClass);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue