aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js
index fc7a02a..3983260 100644
--- a/src/index.js
+++ b/src/index.js
@@ -150,10 +150,16 @@ function parse(value, indexNext, userConfig) {
}
};
+ let idSetByKey = false;
const addAttribute = () => {
switch (type) {
case 'id': // ID
- prop.id = prop.id || labelFirst;
+ if (idSetByKey) {
+ prop.id = labelFirst;
+ idSetByKey = false;
+ } else {
+ prop.id = prop.id || labelFirst;
+ }
break;
case 'class':
if (!prop.class) {
@@ -176,6 +182,11 @@ function parse(value, indexNext, userConfig) {
} else {
prop[labelFirst] = labelFirst === 'class' ? [labelSecond] : labelSecond;
}
+ if (labelFirst === 'id') {
+ idSetByKey = true;
+ }
+ } else if (labelFirst === 'class' && Boolean(labelSecond)) {
+ prop.class.push(labelSecond);
}
break;
default: