Skip to content

Commit

Permalink
Mark common helpers as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
36degrees committed Apr 12, 2023
1 parent c84b53c commit 9b8c313
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/govuk/common/closest-attribute-value.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '../vendor/polyfills/Element/prototype/closest.mjs'
/**
* Returns the value of the given attribute closest to the given element (including itself)
*
* @deprecated Will be made private in v5.0
* @param {Element} $element - The element to start walking the DOM tree up
* @param {string} attributeName - The name of the attribute
* @returns {string | null} Attribute value
Expand Down
4 changes: 4 additions & 0 deletions src/govuk/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* This seems to fail in IE8, requires more investigation.
* See: https://github.com/imagitama/nodelist-foreach-polyfill
*
* @deprecated Will be made private in v5.0
* @template {Node} ElementType
* @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
* @param {nodeListIterator<ElementType>} callback - Callback function to run for each node
Expand All @@ -32,6 +33,7 @@ export function nodeListForEach (nodes, callback) {
* without them conflicting with each other.
* https://stackoverflow.com/a/8809472
*
* @deprecated Will be made private in v5.0
* @returns {string} Unique ID
*/
export function generateUniqueID () {
Expand All @@ -53,6 +55,7 @@ export function generateUniqueID () {
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
* greatest priority on the LAST item passed in.
*
* @deprecated Will be made private in v5.0
* @returns {Object<string, unknown>} A flattened object of key-value pairs.
*/
export function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
Expand Down Expand Up @@ -126,6 +129,7 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
* Extracts keys starting with a particular namespace from a flattened config
* object, removing the namespace in the process.
*
* @deprecated Will be made private in v5.0
* @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
* @param {string} namespace - The namespace to filter keys with.
* @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
Expand Down
2 changes: 2 additions & 0 deletions src/govuk/common/normalise-dataset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import '../vendor/polyfills/String/prototype/trim.mjs'
* Designed to be used to convert config passed via data attributes (which are
* always strings) into something sensible.
*
* @deprecated Will be made private in v5.0
* @param {string} value - The value to normalise
* @returns {string | boolean | number | undefined} Normalised data
*/
Expand Down Expand Up @@ -46,6 +47,7 @@ export function normaliseString (value) {
*
* Loop over an object and normalise each value using normaliseData function
*
* @deprecated Will be made private in v5.0
* @param {DOMStringMap} dataset - HTML element dataset
* @returns {Object<string, unknown>} Normalised dataset
*/
Expand Down

0 comments on commit 9b8c313

Please sign in to comment.