datalist-polyfill.js
function(input, eventType) {
		// We'd like to prevent autocomplete on the input datalist field
		input.setAttribute('autocomplete', 'off');

		// WAI ARIA attributes
		input.setAttribute('role', 'textbox');
		input.setAttribute('aria-haspopup', 'true');
		input.setAttribute('aria-autocomplete', 'list');
		input.setAttribute('aria-owns', input.getAttribute('list'));

		// Bind the keyup event on the related datalists input
		if (eventType === 'focusin') {
			input.addEventListener('keyup', inputInputList);

			input.addEventListener('focusout', changesInputList, true);

			// As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here
			if (isGteIE10 || (isEDGE && input.type === 'text')) {
				input.addEventListener('input', inputInputListIE);
			}
		} else if (eventType === 'blur') {
			input.removeEventListener('keyup', inputInputList);

			input.removeEventListener('focusout', changesInputList, true);

			// As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here
			if (isGteIE10 || (isEDGE && input.type === 'text')) {
				input.removeEventListener('input', inputInputListIE);
			}
		}

		// Add class for identifying that this input is even already being polyfilled
		input.className += ' ' + classNameInput;
	}
function(input, eventType) {
		// We'd like to prevent autocomplete on the input datalist field
		input.setAttribute('autocomplete', 'off');

		// WAI ARIA attributes
		input.setAttribute('role', 'textbox');
		input.setAttribute('aria-haspopup', 'true');
		input.setAttribute('aria-autocomplete', 'list');
		input.setAttribute('aria-owns', input.getAttribute('list'));

		// Bind the keyup event on the related datalists input
		if (eventType === 'focusin') {
			input.addEventListener('keyup', inputInputList);

			input.addEventListener('focusout', changesInputList, true);

			// As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here
			if (isGteIE10 || (isEDGE && input.type === 'text')) {
				input.addEventListener('input', inputInputListIE);
			}
		} else if (eventType === 'blur') {
			input.removeEventListener('keyup', inputInputList);

			input.removeEventListener('focusout', changesInputList, true);

			// As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here
			if (isGteIE10 || (isEDGE && input.type === 'text')) {
				input.removeEventListener('input', inputInputListIE);
			}
		}

		// Add class for identifying that this input is even already being polyfilled
		input.className += ' ' + classNameInput;
	}
function ( input , eventType ) { // We'd like to prevent autocomplete on the input datalist field input . setAttribute ( 'autocomplete' , 'off' ) ; // WAI ARIA attributes input . setAttribute ( 'role' , 'textbox' ) ; input . setAttribute ( 'aria-haspopup' , 'true' ) ; input . setAttribute ( 'aria-autocomplete' , 'list' ) ; input . setAttribute ( 'aria-owns' , input . getAttribute ( 'list' ) ) ; // Bind the keyup event on the related datalists input if ( eventType === 'focusin' ) { input . addEventListener ( 'keyup' , inputInputList ) ; input . addEventListener ( 'focusout' , changesInputList , true ) ; // As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here if ( isGteIE10 || ( isEDGE && input . type === 'text' ) ) { input . addEventListener ( 'input' , inputInputListIE ) ; } } else if ( eventType === 'blur' ) { input . removeEventListener ( 'keyup' , inputInputList ) ; input . removeEventListener ( 'focusout' , changesInputList , true ) ; // As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here if ( isGteIE10 || ( isEDGE && input . type === 'text' ) ) { input . removeEventListener ( 'input' , inputInputListIE ) ; } } // Add class for identifying that this input is even already being polyfilled input . className += ' ' + classNameInput ; }
Prepare the input
Prepare the input