MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / filterValues

Function filterValues

src/test/resources/libraries/htmx/htmx-2.0.0/src/htmx.js:3515–3541  ·  view source on GitHub ↗

* filterValues takes an object containing form input values * and returns a new object that only contains keys that are * specified by the closest "hx-params" attribute * @param {FormData} inputValues * @param {Element} elt * @returns {FormData}

(inputValues, elt)

Source from the content-addressed store, hash-verified

3513 * @returns {FormData}
3514 */
3515 function filterValues(inputValues, elt) {
3516 const paramsValue = getClosestAttributeValue(elt, 'hx-params')
3517 if (paramsValue) {
3518 if (paramsValue === 'none') {
3519 return new FormData()
3520 } else if (paramsValue === '*') {
3521 return inputValues
3522 } else if (paramsValue.indexOf('not ') === 0) {
3523 forEach(paramsValue.substr(4).split(','), function(name) {
3524 name = name.trim()
3525 inputValues.delete(name)
3526 })
3527 return inputValues
3528 } else {
3529 const newValues = new FormData()
3530 forEach(paramsValue.split(','), function(name) {
3531 name = name.trim()
3532 if (inputValues.has(name)) {
3533 inputValues.getAll(name).forEach(function(value) { newValues.append(name, value) })
3534 }
3535 })
3536 return newValues
3537 }
3538 } else {
3539 return inputValues
3540 }
3541 }
3542
3543 /**
3544 * @param {Element} elt

Callers 1

issueAjaxRequestFunction · 0.70

Calls 10

appendMethod · 0.95
trimMethod · 0.80
getClosestAttributeValueFunction · 0.70
forEachFunction · 0.70
indexOfMethod · 0.45
splitMethod · 0.45
deleteMethod · 0.45
hasMethod · 0.45
forEachMethod · 0.45
getAllMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…