google-code-export / zfdebug

Automatically exported from code.google.com/p/zfdebug
Other
1 stars 1 forks source link

Using HTML5 <header> tag making multiple inclusion of css/js #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a html5 <header> tag in your html code

What is the expected output? What do you see instead?
The ZFDebug code (css and js) is introduced multiple time (as many time the 
<header> and <head> is int the response)

What version of the product are you using? On what operating system?
lastest 1.5

Please provide any additional information below.

For fix, replace this line 486 of ZFDebug_Controller_Plugin_Debug
$response->setBody(preg_replace('/(<head.*>)/i', '$1' . $this->_headerOutput(), 
$response->getBody()));
By this
$response->setBody(preg_replace('/(<head( .*)?>)/i', '$1' . 
$this->_headerOutput(), $response->getBody()));

By the way, instead of introducing the css/js after the <head>, you can create 
an option to introduce all the css/js after the body, just before the html of 
the bar, replacing l.486 and 487 like this 
$response->setBody(str_ireplace('</body>', $this->_headerOutput().'<div 
id="ZFDebug_debug">'.$html.'</div></body>', $response->getBody()));
I propose this because I always put my js at the bottom, so jquery is included 
twice because the test of jquery is made before my inclusion...

Original issue reported on code.google.com by mrM...@gmail.com on 29 Jun 2010 at 4:25