This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xerces-j.git


The following commit(s) were added to refs/heads/main by this push:
     new a4c22df61 [XERCESJ-731] correct Javadoc about boolean attributes (#25)
a4c22df61 is described below

commit a4c22df61196c27325fede598f0587f67bf5964e
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Fri Jul 25 07:18:15 2025 -0400

    [XERCESJ-731] correct Javadoc about boolean attributes (#25)
    
    * correct Javadoc
    * [XERCESJ-731] correct Javadoc about boolean attributes
---
 src/org/apache/html/dom/HTMLElementImpl.java | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/org/apache/html/dom/HTMLElementImpl.java 
b/src/org/apache/html/dom/HTMLElementImpl.java
index e4f6a80e0..91c638458 100644
--- a/src/org/apache/html/dom/HTMLElementImpl.java
+++ b/src/org/apache/html/dom/HTMLElementImpl.java
@@ -119,23 +119,25 @@ public class HTMLElementImpl
     /**
      * Convenience method used to translate an attribute value into a boolean
      * value. If the attribute has an associated value (even an empty string),
-     * it is set and true is returned. If the attribute does not exist, false
-     * is returend.
+     * true is returned. If the element does not have this attribute, false
+     * is returned.
      * 
-     * @param value The value of the attribute
-     * @return True or false depending on whether the attribute has been set
+     * @param name the name of the attribute
+     * @return true or false depending on whether the attribute has been set
      */
     boolean getBinary( String name ) {
-        return ( getAttributeNode( name ) != null );
+        return getAttributeNode( name ) != null;
     }
     
     /**
      * Convenience method used to set a boolean attribute. If the value is 
true,
-     * the attribute is set to an empty string. If the value is false, the 
attribute
-     * is removed. HTML 4.0 understands empty strings as set attributes.
-     * 
-     * @param name The name of the attribute
-     * @param value The value of the attribute
+     * the attribute value is set to the attribute's name. For example,
+     * {@code checked="checked"} or {disabled="disabled"}.
+     * If the value is false, the attribute is removed. As long as the
+     * attribute is present, regardless of value, HTML considers a boolean 
attribute to be true.
+     *
+     * @param name the name of the attribute
+     * @param value the truth value of the attribute
      */
     void setAttribute( String name, boolean value ) {
         if ( value ) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to