Make hyphenation in consistent with browser APIs
Javascript snake-case gets turned into kebab-case in HTML Change name attribute in example to match
This commit is contained in:
parent
bc251001bc
commit
ada29b303d
1 changed files with 3 additions and 3 deletions
|
@ -18,15 +18,15 @@ const parseArgs = (element, args) => {
|
||||||
parseArgs(element, arg)
|
parseArgs(element, arg)
|
||||||
else
|
else
|
||||||
for (key in arg)
|
for (key in arg)
|
||||||
element.setAttribute(key.replace("_", "-"), parseAttribute(arg[key]))
|
element.setAttribute(key.replace(/([a-z])([A-Z])/g, "$1-$2"), parseAttribute(arg[key]))
|
||||||
}
|
}
|
||||||
|
|
||||||
const node = (name, args, xmlns) => {
|
const node = (name, args, xmlns) => {
|
||||||
let element
|
let element
|
||||||
if (xmlns)
|
if (xmlns)
|
||||||
element = document.createElementNS(xmlns, name.replace("_", "-"))
|
element = document.createElementNS(xmlns, name.replace(/([a-z])([A-Z])/g, "$1-$2"))
|
||||||
else
|
else
|
||||||
element = document.createElement(name.replace("_", "-"))
|
element = document.createElement(name.replace(/([a-z])([A-Z])/g, "$1-$2"))
|
||||||
parseArgs(element, args)
|
parseArgs(element, args)
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue