Skip to content

Commit 8c3de81

Browse files
committed
refactor: ♻️ apply refactor for usage xmlns namespace enum on xmlnode importe
1 parent 527cec7 commit 8c3de81

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/xml_nodes/xml_node_importer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { NAMESPACE } from '@xmldom/xmldom';
12
import { isElement, isText } from '#src/dom';
23
import { type XmlNodeInterface } from '#src/types';
34
import XmlNode from '#src/xml_nodes/xml_node';
@@ -30,8 +31,8 @@ export default class XmlNodeImporter {
3031

3132
// element is like <element namespace="uri"/>
3233
/* istanbul ignore if -- @preserve Hard of test */
33-
if (element.hasAttributeNS('http://www.w3.org/2000/xmlns/', '')) {
34-
node.setAttribute('xmlns', element.getAttributeNS('http://www.w3.org/2000/xmlns/', ''));
34+
if (element.hasAttributeNS(NAMESPACE.XMLNS, '')) {
35+
node.setAttribute('xmlns', element.getAttributeNS(NAMESPACE.XMLNS, ''));
3536
}
3637

3738
// eslint-disable-next-line unicorn/prefer-spread

0 commit comments

Comments
 (0)