mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
Patch update sections of the page on AJAX
Currently, when we update a section of the page with AJAX we replace the entire HTML of the section with the new HTML. This causes problems: - if you’re trying to interact with that section of the page, eg by inpecting it, clicking or hovering an element - (probably) for screenreaders trying to navigate a page which is changing more than is necessary This commit replaces the call to `.html()` with a pretty clever library called diffDOM[1]. DiffDOM works by taking a diff of the old element and the new element, then doing a patch update, ie only modifying the parts that have changed. This is similar in concept to React’s virtual DOM, while still allowing us to render all markup from one set of templates on the server-side. 1. https://github.com/fiduswriter/diffDOM
This commit is contained in:
@@ -68,7 +68,8 @@ gulp.task('javascripts', () => gulp
|
||||
.pipe(plugins.uglify())
|
||||
.pipe(plugins.addSrc.prepend([
|
||||
paths.npm + 'jquery/dist/jquery.min.js',
|
||||
paths.npm + 'query-command-supported/dist/queryCommandSupported.min.js'
|
||||
paths.npm + 'query-command-supported/dist/queryCommandSupported.min.js',
|
||||
paths.npm + 'diff-dom/diffDOM.js'
|
||||
]))
|
||||
.pipe(plugins.concat('all.js'))
|
||||
.pipe(gulp.dest(paths.dist + 'javascripts/'))
|
||||
|
||||
Reference in New Issue
Block a user