From 55974e596439adb73f5270a01b5c0dd3613bd987 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 1 Sep 2006 16:24:35 +0000 Subject: [PATCH] Merged revisions 363:365 from trunk/ to branches/1.0/ - Fixed slight bug in DOMLex's attribute parsing. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/1.0@366 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 3 +++ library/HTMLPurifier/Lexer/DOMLex.php | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 9acb78ef..7ae5b345 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +1.0.1, unknown release date +- Fixed slight bug in DOMLex attribute parsing + 1.0.0, released 2006-09-01 - Fixed broken numeric entity conversion - Malformed UTF-8 and non-SGML character detection and cleaning implemented diff --git a/library/HTMLPurifier/Lexer/DOMLex.php b/library/HTMLPurifier/Lexer/DOMLex.php index 1ba9675f..2df01f52 100644 --- a/library/HTMLPurifier/Lexer/DOMLex.php +++ b/library/HTMLPurifier/Lexer/DOMLex.php @@ -87,19 +87,20 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer return; } + $attr = $node->hasAttributes() ? + $this->transformAttrToAssoc($node->attributes) : + array(); + // We still have to make sure that the element actually IS empty if (!$node->childNodes->length) { if ($collect) { - $tokens[] = $this->factory->createEmpty( - $node->tagName, - $this->transformAttrToAssoc($node->attributes) - ); + $tokens[] = $this->factory->createEmpty($node->tagName, $attr); } } else { if ($collect) { // don't wrap on first iteration $tokens[] = $this->factory->createStart( $tag_name = $node->tagName, // somehow, it get's dropped - $this->transformAttrToAssoc($node->attributes) + $attr ); } foreach ($node->childNodes as $node) {