Permalink
Browse files

ignore whitespace following a BR

  • Loading branch information...
1 parent 907a512 commit 2194b54dc1e111fa8929c757ec9941a48ab0b9cc @odrobnik odrobnik committed Dec 29, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 Core/Source/DTHTMLAttributedStringBuilder.m
@@ -9,7 +9,9 @@
#import "DTCoreText.h"
#import "DTHTMLAttributedStringBuilder.h"
#import "DTFoundation.h"
+
#import "DTHTMLElementText.h"
+#import "DTHTMLElementBR.h"
@interface DTHTMLAttributedStringBuilder ()
@@ -767,9 +769,15 @@ - (void)parser:(DTHTMLParser *)parser foundCharacters:(NSString *)string
}
// ignore whitespace following a block element
- DTHTMLElement *element = [_currentTag.childNodes lastObject];
+ DTHTMLElement *previousTag = [_currentTag.childNodes lastObject];
+
+ if (previousTag.displayStyle != DTHTMLElementDisplayStyleInline)
+ {
+ return;
+ }
- if (element.displayStyle != DTHTMLElementDisplayStyleInline)
+ // ignore whitespace following a BR
+ if ([previousTag isKindOfClass:[DTHTMLElementBR class]])
{
return;
}

0 comments on commit 2194b54

Please sign in to comment.