mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 16:17:20 +02:00
Optimize createElement()
This commit is contained in:
parent
83a8e1f847
commit
6dbc0990cd
@ -55,16 +55,13 @@ function createElement(elmName, props = {}) {
|
|||||||
|
|
||||||
if (hasNs) {
|
if (hasNs) {
|
||||||
$elm = document.createElementNS(props.xmlns, elmName);
|
$elm = document.createElementNS(props.xmlns, elmName);
|
||||||
|
delete props.xmlns;
|
||||||
} else {
|
} else {
|
||||||
$elm = document.createElement(elmName);
|
$elm = document.createElement(elmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let key in props) {
|
for (const key in props) {
|
||||||
if (key === 'xmlns') {
|
if ($elm.hasOwnProperty(key)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.hasOwnProperty(key) || $elm.hasOwnProperty(key)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user