|
HTML Truncated Due To Unmatched Div Tag March 12, 2012 09:55PM |
Registered: 1 year ago Posts: 18 |
|
Re: HTML Truncated Due To Unmatched Div Tag March 13, 2012 12:50AM |
Admin Registered: 6 years ago Posts: 2,652 |
Yeah, known bug. A bit annoying. Use %Core.LexerImpl set to DirectLex to avoid it (but take a performance hit and some parsing behavior changes!).
|
Re: HTML Truncated Due To Unmatched Div Tag March 13, 2012 11:08AM |
Registered: 1 year ago Posts: 18 |
|
Re: HTML Truncated Due To Unmatched Div Tag March 13, 2012 12:00PM |
Admin Registered: 6 years ago Posts: 2,652 |
|
Re: HTML Truncated Due To Unmatched Div Tag March 13, 2012 12:04PM |
Registered: 1 year ago Posts: 18 |
|
Re: HTML Truncated Due To Unmatched Div Tag March 13, 2012 12:16PM |
Registered: 1 year ago Posts: 18 |
For now, I've fixed it like this:
/**
* @static
* @param string $sHTML
* @return string
*/
public static function getHTMLWithFixForUnmatchedDivTags($sHTML){
$iOpeningDivCount = preg_match_all('/<div/', $sHTML, $aMatches);
$iClosingDivCount = preg_match_all('/<\/div>/', $sHTML, $aMatches);
$sExtraOpeningDivs = null;
if($iClosingDivCount > $iOpeningDivCount)
for($i = 1; $i <= ($iClosingDivCount - $iOpeningDivCount); $i++)
$sExtraOpeningDivs .= "<div>";
return $sExtraOpeningDivs.$sHTML;
}