-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #907 from nhsuk/feature/button-js-fix
Fixed bug where buttons added after page load don't activate JS behaviours
- Loading branch information
Showing
9 changed files
with
52 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
// Components | ||
import Button from './components/button/button' | ||
import CharacterCount from './components/character-count/character-count' | ||
import Checkboxes from './components/checkboxes/checkboxes' | ||
import Details from './components/details/details' | ||
import ErrorSummary from './components/error-summary/error-summary' | ||
import Header from './components/header/header' | ||
import Radios from './components/radios/radios' | ||
import SkipLink from './components/skip-link/skip-link' | ||
import Tabs from './components/tabs/tabs' | ||
import initButton from './components/button/button' | ||
import initCharacterCount from './components/character-count/character-count' | ||
import initCheckboxes from './components/checkboxes/checkboxes' | ||
import initDetails from './components/details/details' | ||
import initErrorSummary from './components/error-summary/error-summary' | ||
import initHeader from './components/header/header' | ||
import initRadios from './components/radios/radios' | ||
import initSkipLink from './components/skip-link/skip-link' | ||
import initTabs from './components/tabs/tabs' | ||
|
||
import './polyfills' | ||
|
||
/** | ||
* Use this function to initialise nhsuk-frontend components within a | ||
* given scope. This function is called by default with the document | ||
* element, but you can call it again later with a new DOM element | ||
* containing nhsuk-frontend components which you wish to initialise. | ||
* | ||
* @param {HTMLElement} scope | ||
*/ | ||
export function initAll(scope) { | ||
initButton({ scope }) | ||
initCharacterCount({ scope }) | ||
initCheckboxes({ scope }) | ||
initDetails({ scope }) | ||
initErrorSummary({ scope }) | ||
initRadios({ scope }) | ||
initTabs({ scope }) | ||
} | ||
|
||
// Initialize components | ||
document.addEventListener('DOMContentLoaded', () => { | ||
CharacterCount() | ||
Button() | ||
Checkboxes() | ||
Details() | ||
ErrorSummary() | ||
Header() | ||
Radios() | ||
SkipLink() | ||
Tabs() | ||
initHeader() | ||
initSkipLink() | ||
|
||
initAll(document) | ||
}) |