Skip to content

Commit

Permalink
refactor(rdom): simplify $el() attrib handling
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 18, 2020
1 parent b310c61 commit b777cf1
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions packages/rdom/src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ATTRIB_JOIN_DELIMS,
formatPrefixes,
mergeClasses,
mergeEmmetAttribs,
NO_SPANS,
RE_TAG,
SVG_TAGS,
Expand Down Expand Up @@ -121,19 +122,8 @@ export const $el = (
) => {
const match = RE_TAG.exec(tag);
if (match) {
let [, mtag, id, clazz] = match;
attribs = { ...attribs };
id && (attribs.id = id);
const aclass = deref(attribs.class);
if (clazz) {
clazz = clazz.replace(/\./g, " ");
attribs.class = aclass ? mergeClasses(clazz, aclass) : clazz;
} else if (aclass) {
attribs.class = isString(aclass)
? aclass
: mergeClasses("", aclass);
}
tag = mtag;
attribs = mergeEmmetAttribs({ ...attribs }, match[2], match[3]);
tag = match[1];
}
let el: Element;
const qidx = tag.indexOf(":");
Expand Down

0 comments on commit b777cf1

Please sign in to comment.