Improve support for autocomplete=off (bug 178597). Check for autocomplete=off on the form element as well as the input, and use case-insensitive string compare.

This commit is contained in:
bryner%brianryner.com 2003-08-09 10:15:31 +00:00
Родитель 5256ed0263
Коммит 38c065c247
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -63,6 +63,7 @@
#include "nsIWidget.h"
#include "nsRect.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMHTMLFormElement.h"
NS_INTERFACE_MAP_BEGIN(nsFormFillController)
NS_INTERFACE_MAP_ENTRY(nsIFormFillController)
@ -499,10 +500,17 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent)
nsAutoString autocomplete;
input->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
if (type.Equals(NS_LITERAL_STRING("text")) &&
!autocomplete.EqualsIgnoreCase("off")) {
if (type.Equals(NS_LITERAL_STRING("text")) &&
!autocomplete.Equals(NS_LITERAL_STRING("off")))
StartControllingInput(input);
nsCOMPtr<nsIDOMHTMLFormElement> form;
input->GetForm(getter_AddRefs(form));
if (form)
form->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
if (!form || !autocomplete.EqualsIgnoreCase("off"))
StartControllingInput(input);
}
}
return NS_OK;