[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml/html
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2009-06-03 6:50:59
Message-ID: 1244011859.219414.12586.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 976963 by ggarand:

match mozilla behaviour for select submission (and arguably html 4.01) :
selects must have a name and disabled options aren't supposed to be
submitted.

BUG: 148981


 M  +6 -2      html_formimpl.cpp  


--- trunk/KDE/kdelibs/khtml/html/html_formimpl.cpp #976962:976963
@@ -2400,6 +2400,10 @@
 
 bool HTMLSelectElementImpl::encoding(const QTextCodec* codec, khtml::encodingList& encoded_values, bool)
 {
+    // submitting with no name would lead to empty lhs ?=foo&=bar
+    if (name().isEmpty())
+        return false;
+
     bool successful = false;
     const QByteArray enc_name = fixUpfromUnicode(codec, name().string());
     const QVector<HTMLGenericFormElementImpl*> items = listItems();
@@ -2409,7 +2413,7 @@
     for (i = 0; i < itemsSize; ++i) {
         if (items[i]->id() == ID_OPTION) {
             HTMLOptionElementImpl* const option = static_cast<HTMLOptionElementImpl*>(items[i]);
-            if (option->selectedBit()) {
+            if (option->selectedBit() && !option->disabled()) {
                 encoded_values += enc_name;
                 encoded_values += fixUpfromUnicode(codec, option->value().string());
                 successful = true;
@@ -2421,7 +2425,7 @@
     // in any case. otherwise we have no consistency with the DOM interface. FIXME!
     // we return the first one if it was a combobox select
     if (!successful && !m_multiple && m_size <= 1 && itemsSize &&
-        (items[0]->id() == ID_OPTION) ) {
+        (items[0]->id() == ID_OPTION && !items[0]->disabled()) ) {
         HTMLOptionElementImpl* const option = static_cast<HTMLOptionElementImpl*>(items[0]);
         encoded_values += enc_name;
         if (option->value().isNull())
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic