src/amazon-autocomplete.js
function _paintWords(prefix, words){
        _flushWordsContainer.call(this);
        this._words = [];
        let docFrag = document.createDocumentFragment();
        for (let i = 0; i < words.length; i++){
            let wordElement = document.createElement('p');
            wordElement.className = 'ac__word';
            wordElement.style.cursor = 'pointer';
            let prefixElement = document.createElement('span');
            prefixElement.className = 'ac__prefix';
            prefixElement.style.pointerEvents = 'none';
            let suffix = document.createTextNode(words[i].slice(prefix.length));
            prefixElement.appendChild(document.createTextNode(prefix));
            wordElement.appendChild(prefixElement);
            wordElement.appendChild(suffix);
            docFrag.appendChild(wordElement);
            this._words.push(wordElement);
        }
        this._container.appendChild(docFrag);
    }
function _paintWords(prefix, words){
        _flushWordsContainer.call(this);
        this._words = [];
        let docFrag = document.createDocumentFragment();
        for (let i = 0; i < words.length; i++){
            let wordElement = document.createElement('p');
            wordElement.className = 'ac__word';
            wordElement.style.cursor = 'pointer';
            let prefixElement = document.createElement('span');
            prefixElement.className = 'ac__prefix';
            prefixElement.style.pointerEvents = 'none';
            let suffix = document.createTextNode(words[i].slice(prefix.length));
            prefixElement.appendChild(document.createTextNode(prefix));
            wordElement.appendChild(prefixElement);
            wordElement.appendChild(suffix);
            docFrag.appendChild(wordElement);
            this._words.push(wordElement);
        }
        this._container.appendChild(docFrag);
    }
function _paintWords ( prefix , words ) { _flushWordsContainer . call ( this ) ; this . _words = [ ] ; let docFrag = document . createDocumentFragment ( ) ; for ( let i = 0 ; i < words . length ; i ++ ) { let wordElement = document . createElement ( 'p' ) ; wordElement . className = 'ac__word' ; wordElement . style . cursor = 'pointer' ; let prefixElement = document . createElement ( 'span' ) ; prefixElement . className = 'ac__prefix' ; prefixElement . style . pointerEvents = 'none' ; let suffix = document . createTextNode ( words [ i ] . slice ( prefix . length ) ) ; prefixElement . appendChild ( document . createTextNode ( prefix ) ) ; wordElement . appendChild ( prefixElement ) ; wordElement . appendChild ( suffix ) ; docFrag . appendChild ( wordElement ) ; this . _words . push ( wordElement ) ; } this . _container . appendChild ( docFrag ) ; }
Build the ui widget that shows the words under the search html input

@param {string} prefix - The letters written by the user in the html search input
@param {Array<string>} words - The list of words that must be painted inside the widget
Build the ui widget that shows the words under the search html input