 					tag.append(first)
 				}
 			} else if char == ">" && inTag != .none {
+				let lastRange = attributeRanges.last?.range
+				let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
+				let range = NSRange(location: location, length: result.mutableString.length - location)
+
+				attributeRanges.append( (range: range, styles: currentStyles) )
+
 				if inTag == .opening {
 					tagStack.append(tag)
 

						result.mutableString.append(delimiter ?? "\"")
						quoteDepth -= 1
					}

					let lastRange = attributeRanges.last?.range
					let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
					let range = NSRange(location: location, length: result.mutableString.length - location)

					attributeRanges.append( ( range: range, styles: currentStyles ))

					if let style = Style(tag: tag) {
						currentStyles.remove(style)

						let delimiter = quoteDepth % 2 == 1 ? locale.quotationBeginDelimiter : locale.alternateQuotationBeginDelimiter
						result.mutableString.append(delimiter ?? "\"")
					}

					if let style = Style(tag: tag) {
						currentStyles.insert(style)
