Review use of form.elements.namedItem() and form.children.namedItem()
Categories
(Toolkit :: Password Manager, task, P3)
Tracking
()
People
(Reporter: serg, Assigned: issammani)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
satchel_common.js and pwmgr_common.js seems to be using similar logic to find element by name
.
Both are using namedItem()
which can also find element by id attribute. Both times we do an extra check to confirm we are not finding element by id.
The difference is that Satchel code is looking into form.elements
and Password Manager is looking into form.children
. .elements
is semantically more appropriate and can find elements deep inside descendants, .children
works only for the immediate children nodes. .elements
does not work for "form-like <div>" though.
Both situations can be improved by using
.querySelector(`name="${name}"]`)
Also there is a comment:
Login Mananger happens to use .namedItem
Which does not seem to be true anymore, I couldn't find references to namedItem
in password manager code.
Lets take the chance to fix tests to use querySelector and stop using confusing namedItem
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D154670
Assignee | ||
Updated•2 years ago
|
Comment 4•2 years ago
|
||
bugherder |
Description
•