diff --git a/packages/cfpb-design-system/src/utilities/behavior/behavior.js b/packages/cfpb-design-system/src/utilities/behavior/behavior.js index 37cdbfbe5..17a241d3a 100644 --- a/packages/cfpb-design-system/src/utilities/behavior/behavior.js +++ b/packages/cfpb-design-system/src/utilities/behavior/behavior.js @@ -45,7 +45,7 @@ function _findElements(behaviorSelector, baseElement) { behaviorElements.length === 0 && behaviorSelector.indexOf(BEHAVIOR_PREFIX) === -1 ) { - behaviorElements = find(behaviorSelector, baseElement); + behaviorElements = behaviorFind(behaviorSelector, baseElement); } return behaviorElements; @@ -60,7 +60,7 @@ function _findElements(behaviorSelector, baseElement) { * for the behavior element. * @returns {Array|NodeList} if it exists in the dom, null otherwise. */ -function attach(behaviorElement, event, eventHandler, baseElement) { +function behaviorAttach(behaviorElement, event, eventHandler, baseElement) { let behaviorElements = []; if (behaviorElement instanceof NodeList === true) { @@ -118,21 +118,12 @@ function checkBehaviorDom(element, behaviorDataAttr) { * for the behavior element. * @returns {NodeList} if it exists in the dom, null otherwise. */ -function find(behaviorSelector, baseElement) { +function behaviorFind(behaviorSelector, baseElement) { behaviorSelector = JS_HOOK + '*=' + BEHAVIOR_PREFIX + behaviorSelector; behaviorSelector = '[' + behaviorSelector + ']'; return _findElements(behaviorSelector, baseElement); } -/** - * @param {HTMLElement} behaviorElement - Element in which to remove the event. - * @param {string} event - Event type to remove from the element. - * @param {Function} eventHandler - Callback for event. - */ -function remove(behaviorElement, event, eventHandler) { - behaviorElement.removeEventListener(event, eventHandler); -} - // Expose public methods. -export { attach, checkBehaviorDom, find, remove }; +export { behaviorAttach, checkBehaviorDom, behaviorFind }; diff --git a/packages/cfpb-design-system/src/utilities/index.js b/packages/cfpb-design-system/src/utilities/index.js index 8d9ed3602..92f888868 100644 --- a/packages/cfpb-design-system/src/utilities/index.js +++ b/packages/cfpb-design-system/src/utilities/index.js @@ -13,7 +13,11 @@ export { EventObserver } from './event-observer.js'; export { checkDom, instantiateAll, setInitFlag } from './atomic-helpers.js'; -export { attach, checkBehaviorDom, find, remove } from './behavior/behavior.js'; +export { + behaviorAttach, + checkBehaviorDom, + behaviorFind, +} from './behavior/behavior.js'; export { isUndefined,