Skip to content

Do not create statics when key attribute value is an empty string #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function interpolate (text) {
return strify(text)
}

function getAttrs (name, attribs) {
function getAttrs (name, attribs, nostatics) {
var specials = {}
var statics = []
var properties = []
Expand Down Expand Up @@ -125,8 +125,13 @@ function getAttrs (name, attribs) {
properties.push(key)
properties.push(interpolate(attrib))
} else {
statics.push(key)
statics.push(attrib)
if (nostatics) {
properties.push(key)
properties.push(strify(attrib))
} else {
statics.push(key)
statics.push(attrib)
}
}
}
return {
Expand Down Expand Up @@ -168,13 +173,17 @@ var handler = {
return
}

var key
if (attribs['key']) {
key = strify(attribs['key'])
var key = attribs['key'], nostatics
if (typeof key !== 'undefined') {
if (key === '') {
nostatics = true
} else {
key = strify(key)
}
delete attribs['key']
}

var attrs = getAttrs(name, attribs)
var attrs = getAttrs(name, attribs, nostatics)
var specials = attrs.specials

if (specials.if) {
Expand Down