From c49d4567dc2e64e42b18fa01c19193b0df0f8367 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 6 Jun 2014 13:02:04 +0900 Subject: [PATCH] Fix default attributes --- autoload/emmet/lang/html.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim index 1468c6c..041c432 100644 --- a/autoload/emmet/lang/html.vim +++ b/autoload/emmet/lang/html.vim @@ -199,15 +199,16 @@ function! emmet#lang#html#parseIntoTree(abbr, type) if item[0] == '[' let atts = item[1:-2] if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') == '' + let ks = [] if has_key(default_attributes, current.name) let dfa = default_attributes[current.name] - let keys = type(dfa) == 3 ? keys(dfa[0]) : keys(dfa) + let ks = type(dfa) == 3 ? keys(dfa[0]) : keys(dfa) endif - if len(keys) == 0 - let keys = keys(default_attributes[current.name . ':src']) + if len(ks) == 0 && has_key(default_attributes, current.name . ':src') + let ks = keys(default_attributes[current.name . ':src']) endif - if len(keys) > 0 - let current.attr[keys[0]] = atts + if len(ks) > 0 + let current.attr[ks[0]] = atts endif else while len(atts)