     for attribute, options of @completions.attributes when attribute.indexOf(prefix) is 0
       completions.push({word: attribute, prefix}) if options.global
 
-    tagAttributes = @completions.tags[@getPreviousTag(editor, cursor)]?.attributes ? []
+    tagAttributes = @getTagAttributes(editor, cursor)
     for attribute in tagAttributes when attribute.indexOf(prefix) is 0
       completions.push({word: attribute, prefix})
 

    line = line.substring(0, quoteIndex)

    attributePattern.exec(line)?[1]

    for attribute, options of @completions.attributes
      completions.push({word: attribute, prefix: ''}) if options.global

    tagAttributes = @getTagAttributes(editor, cursor)
    for attribute in tagAttributes
      completions.push({word: attribute, prefix: ''})

