enketo-core
Advanced tools
Comparing version 5.14.0 to 5.14.1
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://enketo.org", | ||
"version": "5.14.0", | ||
"version": "5.14.1", | ||
"license": "Apache-2.0", | ||
@@ -8,0 +8,0 @@ "os": [ |
@@ -1,2 +0,2 @@ | ||
 | ||
 | ||
[](http://badge.fury.io/js/enketo-core) [](https://travis-ci.org/enketo/enketo-core) [](https://david-dm.org/enketo/enketo-core) [](https://david-dm.org/enketo/enketo-core?type=dev) [](https://www.codacy.com/app/martijnr/enketo-core?utm_source=github.com&utm_medium=referral&utm_content=enketo/enketo-core&utm_campaign=Badge_Grade) | ||
@@ -3,0 +3,0 @@ |
@@ -150,6 +150,10 @@ /** | ||
// the current <option> and <input> elements | ||
const question = template.closest( '.question, .or-repeat-info' ); | ||
// datalist will catch the shared datalists inside .or-repeat-info | ||
const question = template.closest( '.question, datalist' ); | ||
[ ...question.querySelectorAll( templateNodeName ) ].filter( el => el !== template ).forEach( el => el.remove() ); | ||
// labels for current <option> elements | ||
const optionsTranslations = question.querySelector( '.or-option-translations' ); | ||
const next = question.nextElementSibling; | ||
// next is a somewhat fragile match for option-translations belonging to a shared datalist in | ||
// .or-repeat-info if there are multiple shared datalists. | ||
const optionsTranslations = next && next.matches( '.or-option-translations' ) ? next : question.querySelector( '.or-option-translations' ); | ||
if ( optionsTranslations ) { | ||
@@ -156,0 +160,0 @@ [ ...optionsTranslations.children ].forEach( child => child.remove() ); |
@@ -386,2 +386,3 @@ /** | ||
const input = inputs.length ? inputs[ 0 ] : null; | ||
if ( input ) { | ||
@@ -397,12 +398,19 @@ // For very long static datalists, a huge performance improvement can be achieved, by using the | ||
const parent = datalist.parentElement; | ||
const detachedList = parent.removeChild( datalist ); | ||
const name = input.name; | ||
const dl = parent.querySelector( 'datalist' ); | ||
const detachedList = parent.removeChild( dl ); | ||
detachedList.setAttribute( 'data-name', name ); | ||
repeatInfo.appendChild( detachedList ); | ||
const translations = parent.querySelector( '.or-option-translations' ); | ||
const detachedTranslations = parent.removeChild( translations ); | ||
detachedTranslations.setAttribute( 'data-name', name ); | ||
repeatInfo.appendChild( detachedTranslations ); | ||
const labels = parent.querySelector( '.itemset-labels' ); | ||
const detachedTranslations = parent.removeChild( translations ); | ||
const detachedLabels = parent.removeChild( labels ); | ||
repeatInfo.appendChild( detachedTranslations ); | ||
detachedLabels.setAttribute( 'data-name', name ); | ||
repeatInfo.appendChild( detachedLabels ); | ||
this.staticLists.push( id ); | ||
@@ -409,0 +417,0 @@ //input.classList.add( 'shared' ); |
Sorry, the diff of this file is too big to display
863238
13547