Changeset 30095

Show
Ignore:
Timestamp:
2008-02-08 11:23:08 (7 months ago)
Author:
hyatt@apple.com
Message:

Fix for bug 16798, button should default to type=submit.

Reviewed by darin

  • html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::type): (WebCore::HTMLButtonElement::parseMappedAttribute):
Location:
trunk/WebCore
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30092 r30095  
     12008-02-08  David Hyatt  <hyatt@apple.com> 
     2 
     3        Fix for bug 16798, button should default to type=submit. 
     4 
     5        Reviewed by darin 
     6 
     7        * html/HTMLButtonElement.cpp: 
     8        (WebCore::HTMLButtonElement::type): 
     9        (WebCore::HTMLButtonElement::parseMappedAttribute): 
     10 
    1112008-02-08  Rodney Dawes  <dobey@wayofthemonkey.com> 
    212 
  • trunk/WebCore/html/HTMLButtonElement.cpp

    r28620 r30095  
    5757const AtomicString& HTMLButtonElement::type() const 
    5858{ 
    59     return getAttribute(typeAttr); 
     59    switch (m_type) { 
     60        case SUBMIT: { 
     61            static const AtomicString submit("submit"); 
     62            return submit; 
     63        } 
     64        case BUTTON: { 
     65            static const AtomicString button("button"); 
     66            return button; 
     67        } 
     68        case RESET: { 
     69            static const AtomicString reset("reset"); 
     70            return reset; 
     71        } 
     72    } 
     73 
     74    ASSERT_NOT_REACHED(); 
     75    return emptyAtom; 
    6076} 
    6177 
     
    6379{ 
    6480    if (attr->name() == typeAttr) { 
    65         if (equalIgnoringCase(attr->value(), "submit")) 
    66             m_type = SUBMIT; 
    67         else if (equalIgnoringCase(attr->value(), "reset")) 
     81        if (equalIgnoringCase(attr->value(), "reset")) 
    6882            m_type = RESET; 
    6983        else if (equalIgnoringCase(attr->value(), "button")) 
    7084            m_type = BUTTON; 
     85        else 
     86            m_type = SUBMIT; 
    7187    } else if (attr->name() == alignAttr) { 
    7288        // Don't map 'align' attribute.  This matches what Firefox and IE do, but not Opera.