Skip to content

Commit

Permalink
Merge #5400 and #5401 from 4.1 into 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Feb 12, 2024
2 parents 28bf336 + b31df99 commit d918884
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion impl/src/main/java/com/sun/faces/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,9 @@ public static String getResponseEncoding(FacesContext context, Optional<String>

if (encoding == null) {
// 5. If still none found then fall back to specified default.
encoding = defaultEncoding.get();
if (defaultEncoding.isPresent()) {
encoding = defaultEncoding.get();
}

if (encoding != null && !encoding.isBlank()) {
if (LOGGER.isLoggable(FINEST)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,14 @@ if ( !( (window.faces && window.faces.specversion && window.faces.specversion >=
const coreElementProperties = ['className', 'title', 'lang', 'xmllang'];

// enumerate additional input element attributes
const inputElementProperties = [ 'name', 'value', 'size', 'maxLength', 'src', 'alt', 'useMap', 'tabIndex', 'accessKey', 'accept', 'type' ];
const inputElementProperties = [ 'name', 'value', 'src', 'alt', 'useMap', 'tabIndex', 'accessKey', 'accept', 'type' ];

// core + input element properties
const coreAndInputElementProperties = coreElementProperties.concat(inputElementProperties);

// enumerate additional integer input attributes
const inputElementPositiveIntegerProperties = [ 'size', 'maxLength' ];

// enumerate additional boolean input attributes
const inputElementBooleanProperties = [ 'checked', 'disabled', 'readOnly' ];

Expand All @@ -679,10 +682,17 @@ if ( !( (window.faces && window.faces.specversion && window.faces.specversion >=
if (isNotNull(sourceValue)) target[propertyName] = sourceValue;
}

const booleanPropertyNames = isInputElement ? inputElementBooleanProperties : [];
for (const booleanPropertyName of booleanPropertyNames) {
const newBooleanValue = source[booleanPropertyName];
if (isNotNull(newBooleanValue)) target[booleanPropertyName] = newBooleanValue;
if (isInputElement) {
for (const propertyName of inputElementPositiveIntegerProperties) {
const attributeName = propertyToAttribute(propertyName);
const sourceValue = isXML ? source.getAttribute(attributeName) : source[propertyName];
if (parseInt(sourceValue) >= 0) target[propertyName] = sourceValue;
}

for (const booleanPropertyName of inputElementBooleanProperties) {
const newBooleanValue = source[booleanPropertyName];
if (isNotNull(newBooleanValue)) target[booleanPropertyName] = newBooleanValue;
}
}

//'style' attribute special case
Expand Down

0 comments on commit d918884

Please sign in to comment.