JDK-4865025 : HTML Documents with <input type="button"> not recognized
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.1_06,1.4.1,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8,windows_2000
  • CPU: x86,sparc
  • Submitted: 2003-05-15
  • Updated: 2003-05-19
  • Resolved: 2003-05-19
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 05/15/2003


FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)


FULL OS VERSION :
SunOS muirwoods 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-60


A DESCRIPTION OF THE PROBLEM :
HTMLDocument is supposed to recognize tags of the form

<input type="button">

according to the documentation of FormAction:

 	 * The following are the model assignments for the
	 * various type of form elements.
 	 * <table>
 	 * <tr>
 	 *   <th>Element Type
 	 *   <th>Model Type
 	 * <tr>
 	 *   <td>input, type button
 	 *   <td>DefaultButtonModel

however buttons don't seem to be recognized. This appears to be because FormAction.setModel at line 2923 of HTMLDocument.java 1.148 omits "button" from the statement:

	    void setModel(String type, MutableAttributeSet attr) {
		if (type.equals("submit") ||
		    type.equals("reset") ||
		    type.equals("image")) {

		    // button model
		    attr.addAttribute(StyleConstants.ModelAttribute,
				      new DefaultButtonModel());
...



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Try viewing something with an <input type="button">; I get nothing.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
        ElementIterator iter = new ElementIterator(document);
        Element elem = null;
        while ((elem = iter.next()) != null)
        {
            if (elem.getName().equalsIgnoreCase(HTML.Tag.INPUT.toString()))
            {
                Object model = elem.getAttributes().getAttribute(StyleConstants.ModelAttribute);
                if (model instanceof DefaultButtonModel)
                {
                    DefaultButtonModel buttonModel = (DefaultButtonModel) model;
                    buttonModel.addActionListener(listener);
                    System.out.println(elem.toString());
                }
            }
        }
    }

---------- END SOURCE ----------
(Review ID: 185737) 
======================================================================

Comments
EVALUATION <input type="button"> is part of html 4.0 Currently we do not fully support this standart. Closing this bug as dup for 4296022
2004-06-11