diff --git a/readme.md b/readme.md index e11445c..00cb54f 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,17 @@ Responsive hierarchical nav. +## Browser Support + +Tested and working on: + +* Chrome +* Firefox + +Tested and needs fixing: + +* IE: responsive doesn't work. Needs fix in [o-squishy-list](https://github.com/Financial-Times/o-squishy-list) + ## Navigation All Navigation options have the same general markup structure that you can see in [main.mustache](https://github.com/Financial-Times/o-hierarchical-nav/blob/master/main.mustache) diff --git a/src/js/ResponsiveNav.js b/src/js/ResponsiveNav.js index 4ca0444..4e33092 100644 --- a/src/js/ResponsiveNav.js +++ b/src/js/ResponsiveNav.js @@ -34,18 +34,30 @@ function ResponsiveNav(rootEl) { function addItemToMoreList(text, href, ul) { var itemEl = document.createElement('li'), aEl = document.createElement('a'); - aEl.innerText = text; + + window.hiya = aEl; + if (typeof aEl.textContent !== 'undefined') { + console.log('hi'); + aEl.textContent = text; + console.log(aEl); + } else { + aEl.innerText = text; + } aEl.href = href; itemEl.appendChild(aEl); moreListEl.appendChild(itemEl); } function populateMoreList(hiddenEls) { - emptyMoreList(); + if (!isMegaDropdownControl(moreEl)) { + emptyMoreList(); + } for (var c = 0, l = hiddenEls.length; c < l; c++) { var aEl = hiddenEls[c].querySelector('a'); var ulEl = hiddenEls[c].querySelector('ul'); - addItemToMoreList(aEl.innerText, aEl.href, ulEl); + + var aText = (typeof aEl.textContent !== 'undefined') ? aEl.textContent : aEl.innerText; + addItemToMoreList(aText, aEl.href, ulEl); } }