[PATCH] html_formimpl.cpp
Pascal Létourneau
pletourn at globetrotter.net
Tue Oct 8 15:09:38 BST 2002
Hi
According to http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1 :
"If no OPTION element has the selected attribute set, user agent behavior for
choosing which option is initially selected is undefined."
Other browsers (MSIE, Mozilla, Netscape 4.x) don't preselect anything in that
case.
This make the use of http://www.nvidia.com/content/drivers/drivers.asp a
little difficult. To really select the first element, one have to select
another one then select the first one.
Pascal Létourneau
Index: html_formimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v
retrieving revision 1.292
diff -u -3 -p -r1.292 html_formimpl.cpp
--- html_formimpl.cpp 2002/09/28 16:51:59 1.292
+++ html_formimpl.cpp 2002/10/07 21:13:43
@@ -1583,7 +1584,7 @@ void HTMLSelectElementImpl::restoreState
recalcListItems();
QString state = _state;
- if(!state.isEmpty() && !state.contains('X') && !m_multiple) {
+ if(!state.isEmpty() && !state.contains('X') && !m_multiple && m_size==1 )
{
qWarning("should not happen in restoreState!");
state[0] = 'X';
}
@@ -1774,11 +1775,11 @@ void HTMLSelectElementImpl::recalcListIt
if (current->id() == ID_OPTION) {
m_listItems.resize(m_listItems.size()+1);
m_listItems[m_listItems.size()-1] =
static_cast<HTMLGenericFormElementImpl*>(current);
- if (!foundSelected && !m_multiple) {
+ if (!foundSelected && !m_multiple && m_size==1) {
foundSelected = static_cast<HTMLOptionElementImpl*>(current);
foundSelected->m_selected = true;
}
- else if (foundSelected && !m_multiple &&
static_cast<HTMLOptionElementImpl*>(current)->selected()) {
+ else if (foundSelected && !m_multiple && m_size==1 &&
static_cast<HTMLOptionElementImpl*>(current)->selected()) {
foundSelected->m_selected = false;
foundSelected = static_cast<HTMLOptionElementImpl*>(current);
}
More information about the kfm-devel
mailing list