chrisdevereux/Slash

Applying inner elements attributes wipes out attributes applied by outer elements

macdrevx opened this issue · 2 comments

The README explains:

When a piece of text belongs to multiple elements, the attributes applied will be the union of each tag's dictionary, with the innermost elements' attributes taking priority.

It seems like this is intended to be accomplished by the call to -[NSMutableAttributedString setAttributes:range:] in -[SLSMarkupParser applyAttributes], which applies styles for outer elements before inner elements.

However, the docs for -[NSMutableAttributedString setAttributes:range:] note:

These new attributes replace any attributes previously associated with the characters in aRange.

This is consistent with the behavior I have observed in my tests. Namely, all styles for outer elements are removed when applying styles for inner elements.

Thanks! Yep, not sure how that snuck through...

You're welcome. Thanks for the short turnaround time.