From: Benoît Pin Date: Fri, 11 Apr 2014 11:00:28 +0000 (+0200) Subject: Dans certains cas, il n'y a pas encore de balise dans l'en-tête. On l'ajoute... X-Git-Url: https://scm.cri.mines-paristech.fr/git/Plinn.git/commitdiff_plain/0bc314cf82acc788fbad22b1cc0aa7ffe9b9fcb4?ds=inline;hp=-c Dans certains cas, il n'y a pas encore de balise dans l'en-tête. On l'ajoute donc. --- 0bc314cf82acc788fbad22b1cc0aa7ffe9b9fcb4 diff --git a/skins/ajax_scripts/ajax_form_manager.js b/skins/ajax_scripts/ajax_form_manager.js index 12ca5b2..d3efec3 100644 --- a/skins/ajax_scripts/ajax_form_manager.js +++ b/skins/ajax_scripts/ajax_form_manager.js @@ -406,9 +406,14 @@ FormManager.prototype.loadResponse = function(req) { break; case 'base' : var headBase = document.getElementsByTagName('base'); - if (headBase.length) { + if (headBase.length > 0) { headBase[0].setAttribute('href', element.getAttribute('href')); } + else { + headBase = document.createElement('base'); + headBase.setAttribute('href', element.getAttribute('href')); + document.head.appendChild(headBase); + } break; } } diff --git a/skins/ajax_scripts/fragment_importer.js b/skins/ajax_scripts/fragment_importer.js index d9110cd..52d7eb0 100644 --- a/skins/ajax_scripts/fragment_importer.js +++ b/skins/ajax_scripts/fragment_importer.js @@ -90,9 +90,14 @@ FragmentImporter.prototype.populateBaseElement = function(req) { break; case 'base' : var headBase = document.getElementsByTagName('base'); - if (headBase.length) { + if (headBase.length > 0) { headBase[0].setAttribute('href', element.getAttribute('href')); } + else { + headBase = document.createElement('base'); + headBase.setAttribute('href', element.getAttribute('href')); + document.head.appendChild(headBase); + } break; } }