Move logic from dom to xml module
This commit is contained in:
@@ -122,27 +122,3 @@ export function replaceChildren(node, children) {
|
|||||||
node.insertBefore(newChild, oldChild);
|
node.insertBefore(newChild, oldChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let document_ = undefined;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a Document to use when creating nodes for XML serializations. Can be used
|
|
||||||
* to inject a Document where there is no globally available implementation.
|
|
||||||
*
|
|
||||||
* @param {Document} document A Document.
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
export function registerDocument(document) {
|
|
||||||
document_ = document;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a document that should be used when creating nodes for XML serializations.
|
|
||||||
* @return {Document} The document.
|
|
||||||
*/
|
|
||||||
export function getDocument() {
|
|
||||||
if (document_ === undefined && typeof document !== 'undefined') {
|
|
||||||
document_ = document.implementation.createDocument('', '', null);
|
|
||||||
}
|
|
||||||
return document_;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/format/xsd
|
* @module ol/format/xsd
|
||||||
*/
|
*/
|
||||||
import {getDocument} from '../dom.js';
|
import {getAllTextContent, getDocument} from '../xml.js';
|
||||||
import {getAllTextContent} from '../xml.js';
|
|
||||||
import {padNumber} from '../string.js';
|
import {padNumber} from '../string.js';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+25
-1
@@ -2,7 +2,6 @@
|
|||||||
* @module ol/xml
|
* @module ol/xml
|
||||||
*/
|
*/
|
||||||
import {extend} from './array.js';
|
import {extend} from './array.js';
|
||||||
import {getDocument} from './dom.js';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -509,3 +508,28 @@ export function getXMLSerializer() {
|
|||||||
}
|
}
|
||||||
return xmlSerializer_;
|
return xmlSerializer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let document_ = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a Document to use when creating nodes for XML serializations. Can be used
|
||||||
|
* to inject a Document where there is no globally available implementation.
|
||||||
|
*
|
||||||
|
* @param {Document} document A Document.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
export function registerDocument(document) {
|
||||||
|
document_ = document;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a document that should be used when creating nodes for XML serializations.
|
||||||
|
* @return {Document} The document.
|
||||||
|
*/
|
||||||
|
export function getDocument() {
|
||||||
|
if (document_ === undefined && typeof document !== 'undefined') {
|
||||||
|
document_ = document.implementation.createDocument('', '', null);
|
||||||
|
}
|
||||||
|
return document_;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user