From ef1a764b1efca373fb62e14f1388c6dc0fbd631f Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 3 Jan 2019 09:15:14 +0100 Subject: Update id property priority --- dist/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'dist/index.js') diff --git a/dist/index.js b/dist/index.js index 8ae7b4f..ab96cab 100644 --- a/dist/index.js +++ b/dist/index.js @@ -157,11 +157,19 @@ function parse(value, indexNext, userConfig) { } }; + var idSetByKey = false; + var addAttribute = function 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': @@ -188,6 +196,12 @@ 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; -- cgit v1.2.3