solid-ui 2.4.13 → 2.4.14-5a8f87a9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15428,10 +15428,10 @@ Object.defineProperty(exports, "__esModule", {
15428
15428
  });
15429
15429
  exports["default"] = void 0;
15430
15430
  var _default = {
15431
- buildTime: '2021-12-25T19:07:50Z',
15432
- commit: '86bc253a888d14296d3f0d9ff48462c64f83a08b',
15431
+ buildTime: '2021-12-27T11:33:36Z',
15432
+ commit: '5a8f87a9a6c3dafc183343930dd4d0b406ce35c6',
15433
15433
  npmInfo: {
15434
- 'solid-ui': '2.4.13',
15434
+ 'solid-ui': '2.4.14',
15435
15435
  npm: '6.14.15',
15436
15436
  ares: '1.18.1',
15437
15437
  brotli: '1.0.9',
@@ -26258,6 +26258,2999 @@ class AggregateHandler {
26258
26258
  exports.default = AggregateHandler;
26259
26259
  //# sourceMappingURL=AggregateHandler.js.map
26260
26260
 
26261
+ /***/ }),
26262
+
26263
+ /***/ "./node_modules/@xmldom/xmldom/lib/conventions.js":
26264
+ /*!********************************************************!*\
26265
+ !*** ./node_modules/@xmldom/xmldom/lib/conventions.js ***!
26266
+ \********************************************************/
26267
+ /*! no static exports found */
26268
+ /***/ (function(module, exports, __webpack_require__) {
26269
+
26270
+ "use strict";
26271
+
26272
+
26273
+ /**
26274
+ * "Shallow freezes" an object to render it immutable.
26275
+ * Uses `Object.freeze` if available,
26276
+ * otherwise the immutability is only in the type.
26277
+ *
26278
+ * Is used to create "enum like" objects.
26279
+ *
26280
+ * @template T
26281
+ * @param {T} object the object to freeze
26282
+ * @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
26283
+ * allows to inject custom object constructor for tests
26284
+ * @returns {Readonly<T>}
26285
+ *
26286
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
26287
+ */
26288
+ function freeze(object, oc) {
26289
+ if (oc === undefined) {
26290
+ oc = Object
26291
+ }
26292
+ return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
26293
+ }
26294
+
26295
+ /**
26296
+ * All mime types that are allowed as input to `DOMParser.parseFromString`
26297
+ *
26298
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
26299
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
26300
+ * @see DOMParser.prototype.parseFromString
26301
+ */
26302
+ var MIME_TYPE = freeze({
26303
+ /**
26304
+ * `text/html`, the only mime type that triggers treating an XML document as HTML.
26305
+ *
26306
+ * @see DOMParser.SupportedType.isHTML
26307
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
26308
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
26309
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
26310
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
26311
+ */
26312
+ HTML: 'text/html',
26313
+
26314
+ /**
26315
+ * Helper method to check a mime type if it indicates an HTML document
26316
+ *
26317
+ * @param {string} [value]
26318
+ * @returns {boolean}
26319
+ *
26320
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
26321
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
26322
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
26323
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
26324
+ isHTML: function (value) {
26325
+ return value === MIME_TYPE.HTML
26326
+ },
26327
+
26328
+ /**
26329
+ * `application/xml`, the standard mime type for XML documents.
26330
+ *
26331
+ * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
26332
+ * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
26333
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
26334
+ */
26335
+ XML_APPLICATION: 'application/xml',
26336
+
26337
+ /**
26338
+ * `text/html`, an alias for `application/xml`.
26339
+ *
26340
+ * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
26341
+ * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
26342
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
26343
+ */
26344
+ XML_TEXT: 'text/xml',
26345
+
26346
+ /**
26347
+ * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
26348
+ * but is parsed as an XML document.
26349
+ *
26350
+ * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
26351
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
26352
+ * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
26353
+ */
26354
+ XML_XHTML_APPLICATION: 'application/xhtml+xml',
26355
+
26356
+ /**
26357
+ * `image/svg+xml`,
26358
+ *
26359
+ * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
26360
+ * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
26361
+ * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
26362
+ */
26363
+ XML_SVG_IMAGE: 'image/svg+xml',
26364
+ })
26365
+
26366
+ /**
26367
+ * Namespaces that are used in this code base.
26368
+ *
26369
+ * @see http://www.w3.org/TR/REC-xml-names
26370
+ */
26371
+ var NAMESPACE = freeze({
26372
+ /**
26373
+ * The XHTML namespace.
26374
+ *
26375
+ * @see http://www.w3.org/1999/xhtml
26376
+ */
26377
+ HTML: 'http://www.w3.org/1999/xhtml',
26378
+
26379
+ /**
26380
+ * Checks if `uri` equals `NAMESPACE.HTML`.
26381
+ *
26382
+ * @param {string} [uri]
26383
+ *
26384
+ * @see NAMESPACE.HTML
26385
+ */
26386
+ isHTML: function (uri) {
26387
+ return uri === NAMESPACE.HTML
26388
+ },
26389
+
26390
+ /**
26391
+ * The SVG namespace.
26392
+ *
26393
+ * @see http://www.w3.org/2000/svg
26394
+ */
26395
+ SVG: 'http://www.w3.org/2000/svg',
26396
+
26397
+ /**
26398
+ * The `xml:` namespace.
26399
+ *
26400
+ * @see http://www.w3.org/XML/1998/namespace
26401
+ */
26402
+ XML: 'http://www.w3.org/XML/1998/namespace',
26403
+
26404
+ /**
26405
+ * The `xmlns:` namespace
26406
+ *
26407
+ * @see https://www.w3.org/2000/xmlns/
26408
+ */
26409
+ XMLNS: 'http://www.w3.org/2000/xmlns/',
26410
+ })
26411
+
26412
+ exports.freeze = freeze;
26413
+ exports.MIME_TYPE = MIME_TYPE;
26414
+ exports.NAMESPACE = NAMESPACE;
26415
+
26416
+
26417
+ /***/ }),
26418
+
26419
+ /***/ "./node_modules/@xmldom/xmldom/lib/dom-parser.js":
26420
+ /*!*******************************************************!*\
26421
+ !*** ./node_modules/@xmldom/xmldom/lib/dom-parser.js ***!
26422
+ \*******************************************************/
26423
+ /*! no static exports found */
26424
+ /***/ (function(module, exports, __webpack_require__) {
26425
+
26426
+ var conventions = __webpack_require__(/*! ./conventions */ "./node_modules/@xmldom/xmldom/lib/conventions.js");
26427
+ var dom = __webpack_require__(/*! ./dom */ "./node_modules/@xmldom/xmldom/lib/dom.js")
26428
+ var entities = __webpack_require__(/*! ./entities */ "./node_modules/@xmldom/xmldom/lib/entities.js");
26429
+ var sax = __webpack_require__(/*! ./sax */ "./node_modules/@xmldom/xmldom/lib/sax.js");
26430
+
26431
+ var DOMImplementation = dom.DOMImplementation;
26432
+
26433
+ var NAMESPACE = conventions.NAMESPACE;
26434
+
26435
+ var ParseError = sax.ParseError;
26436
+ var XMLReader = sax.XMLReader;
26437
+
26438
+ /**
26439
+ * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:
26440
+ *
26441
+ * > XML parsed entities are often stored in computer files which,
26442
+ * > for editing convenience, are organized into lines.
26443
+ * > These lines are typically separated by some combination
26444
+ * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
26445
+ * >
26446
+ * > To simplify the tasks of applications, the XML processor must behave
26447
+ * > as if it normalized all line breaks in external parsed entities (including the document entity)
26448
+ * > on input, before parsing, by translating all of the following to a single #xA character:
26449
+ * >
26450
+ * > 1. the two-character sequence #xD #xA
26451
+ * > 2. the two-character sequence #xD #x85
26452
+ * > 3. the single character #x85
26453
+ * > 4. the single character #x2028
26454
+ * > 5. any #xD character that is not immediately followed by #xA or #x85.
26455
+ *
26456
+ * @param {string} input
26457
+ * @returns {string}
26458
+ */
26459
+ function normalizeLineEndings(input) {
26460
+ return input
26461
+ .replace(/\r[\n\u0085]/g, '\n')
26462
+ .replace(/[\r\u0085\u2028]/g, '\n')
26463
+ }
26464
+
26465
+ /**
26466
+ * @typedef Locator
26467
+ * @property {number} [columnNumber]
26468
+ * @property {number} [lineNumber]
26469
+ */
26470
+
26471
+ /**
26472
+ * @typedef DOMParserOptions
26473
+ * @property {DOMHandler} [domBuilder]
26474
+ * @property {Function} [errorHandler]
26475
+ * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing
26476
+ * defaults to `normalizeLineEndings`
26477
+ * @property {Locator} [locator]
26478
+ * @property {Record<string, string>} [xmlns]
26479
+ *
26480
+ * @see normalizeLineEndings
26481
+ */
26482
+
26483
+ /**
26484
+ * The DOMParser interface provides the ability to parse XML or HTML source code
26485
+ * from a string into a DOM `Document`.
26486
+ *
26487
+ * _xmldom is different from the spec in that it allows an `options` parameter,
26488
+ * to override the default behavior._
26489
+ *
26490
+ * @param {DOMParserOptions} [options]
26491
+ * @constructor
26492
+ *
26493
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
26494
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
26495
+ */
26496
+ function DOMParser(options){
26497
+ this.options = options ||{locator:{}};
26498
+ }
26499
+
26500
+ DOMParser.prototype.parseFromString = function(source,mimeType){
26501
+ var options = this.options;
26502
+ var sax = new XMLReader();
26503
+ var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
26504
+ var errorHandler = options.errorHandler;
26505
+ var locator = options.locator;
26506
+ var defaultNSMap = options.xmlns||{};
26507
+ var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
26508
+ var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
26509
+ if(locator){
26510
+ domBuilder.setDocumentLocator(locator)
26511
+ }
26512
+
26513
+ sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
26514
+ sax.domBuilder = options.domBuilder || domBuilder;
26515
+ if(isHTML){
26516
+ defaultNSMap[''] = NAMESPACE.HTML;
26517
+ }
26518
+ defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
26519
+ var normalize = options.normalizeLineEndings || normalizeLineEndings;
26520
+ if (source && typeof source === 'string') {
26521
+ sax.parse(
26522
+ normalize(source),
26523
+ defaultNSMap,
26524
+ entityMap
26525
+ )
26526
+ } else {
26527
+ sax.errorHandler.error('invalid doc source')
26528
+ }
26529
+ return domBuilder.doc;
26530
+ }
26531
+ function buildErrorHandler(errorImpl,domBuilder,locator){
26532
+ if(!errorImpl){
26533
+ if(domBuilder instanceof DOMHandler){
26534
+ return domBuilder;
26535
+ }
26536
+ errorImpl = domBuilder ;
26537
+ }
26538
+ var errorHandler = {}
26539
+ var isCallback = errorImpl instanceof Function;
26540
+ locator = locator||{}
26541
+ function build(key){
26542
+ var fn = errorImpl[key];
26543
+ if(!fn && isCallback){
26544
+ fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
26545
+ }
26546
+ errorHandler[key] = fn && function(msg){
26547
+ fn('[xmldom '+key+']\t'+msg+_locator(locator));
26548
+ }||function(){};
26549
+ }
26550
+ build('warning');
26551
+ build('error');
26552
+ build('fatalError');
26553
+ return errorHandler;
26554
+ }
26555
+
26556
+ //console.log('#\n\n\n\n\n\n\n####')
26557
+ /**
26558
+ * +ContentHandler+ErrorHandler
26559
+ * +LexicalHandler+EntityResolver2
26560
+ * -DeclHandler-DTDHandler
26561
+ *
26562
+ * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
26563
+ * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
26564
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
26565
+ */
26566
+ function DOMHandler() {
26567
+ this.cdata = false;
26568
+ }
26569
+ function position(locator,node){
26570
+ node.lineNumber = locator.lineNumber;
26571
+ node.columnNumber = locator.columnNumber;
26572
+ }
26573
+ /**
26574
+ * @see org.xml.sax.ContentHandler#startDocument
26575
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
26576
+ */
26577
+ DOMHandler.prototype = {
26578
+ startDocument : function() {
26579
+ this.doc = new DOMImplementation().createDocument(null, null, null);
26580
+ if (this.locator) {
26581
+ this.doc.documentURI = this.locator.systemId;
26582
+ }
26583
+ },
26584
+ startElement:function(namespaceURI, localName, qName, attrs) {
26585
+ var doc = this.doc;
26586
+ var el = doc.createElementNS(namespaceURI, qName||localName);
26587
+ var len = attrs.length;
26588
+ appendElement(this, el);
26589
+ this.currentElement = el;
26590
+
26591
+ this.locator && position(this.locator,el)
26592
+ for (var i = 0 ; i < len; i++) {
26593
+ var namespaceURI = attrs.getURI(i);
26594
+ var value = attrs.getValue(i);
26595
+ var qName = attrs.getQName(i);
26596
+ var attr = doc.createAttributeNS(namespaceURI, qName);
26597
+ this.locator &&position(attrs.getLocator(i),attr);
26598
+ attr.value = attr.nodeValue = value;
26599
+ el.setAttributeNode(attr)
26600
+ }
26601
+ },
26602
+ endElement:function(namespaceURI, localName, qName) {
26603
+ var current = this.currentElement
26604
+ var tagName = current.tagName;
26605
+ this.currentElement = current.parentNode;
26606
+ },
26607
+ startPrefixMapping:function(prefix, uri) {
26608
+ },
26609
+ endPrefixMapping:function(prefix) {
26610
+ },
26611
+ processingInstruction:function(target, data) {
26612
+ var ins = this.doc.createProcessingInstruction(target, data);
26613
+ this.locator && position(this.locator,ins)
26614
+ appendElement(this, ins);
26615
+ },
26616
+ ignorableWhitespace:function(ch, start, length) {
26617
+ },
26618
+ characters:function(chars, start, length) {
26619
+ chars = _toString.apply(this,arguments)
26620
+ //console.log(chars)
26621
+ if(chars){
26622
+ if (this.cdata) {
26623
+ var charNode = this.doc.createCDATASection(chars);
26624
+ } else {
26625
+ var charNode = this.doc.createTextNode(chars);
26626
+ }
26627
+ if(this.currentElement){
26628
+ this.currentElement.appendChild(charNode);
26629
+ }else if(/^\s*$/.test(chars)){
26630
+ this.doc.appendChild(charNode);
26631
+ //process xml
26632
+ }
26633
+ this.locator && position(this.locator,charNode)
26634
+ }
26635
+ },
26636
+ skippedEntity:function(name) {
26637
+ },
26638
+ endDocument:function() {
26639
+ this.doc.normalize();
26640
+ },
26641
+ setDocumentLocator:function (locator) {
26642
+ if(this.locator = locator){// && !('lineNumber' in locator)){
26643
+ locator.lineNumber = 0;
26644
+ }
26645
+ },
26646
+ //LexicalHandler
26647
+ comment:function(chars, start, length) {
26648
+ chars = _toString.apply(this,arguments)
26649
+ var comm = this.doc.createComment(chars);
26650
+ this.locator && position(this.locator,comm)
26651
+ appendElement(this, comm);
26652
+ },
26653
+
26654
+ startCDATA:function() {
26655
+ //used in characters() methods
26656
+ this.cdata = true;
26657
+ },
26658
+ endCDATA:function() {
26659
+ this.cdata = false;
26660
+ },
26661
+
26662
+ startDTD:function(name, publicId, systemId) {
26663
+ var impl = this.doc.implementation;
26664
+ if (impl && impl.createDocumentType) {
26665
+ var dt = impl.createDocumentType(name, publicId, systemId);
26666
+ this.locator && position(this.locator,dt)
26667
+ appendElement(this, dt);
26668
+ this.doc.doctype = dt;
26669
+ }
26670
+ },
26671
+ /**
26672
+ * @see org.xml.sax.ErrorHandler
26673
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
26674
+ */
26675
+ warning:function(error) {
26676
+ console.warn('[xmldom warning]\t'+error,_locator(this.locator));
26677
+ },
26678
+ error:function(error) {
26679
+ console.error('[xmldom error]\t'+error,_locator(this.locator));
26680
+ },
26681
+ fatalError:function(error) {
26682
+ throw new ParseError(error, this.locator);
26683
+ }
26684
+ }
26685
+ function _locator(l){
26686
+ if(l){
26687
+ return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
26688
+ }
26689
+ }
26690
+ function _toString(chars,start,length){
26691
+ if(typeof chars == 'string'){
26692
+ return chars.substr(start,length)
26693
+ }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
26694
+ if(chars.length >= start+length || start){
26695
+ return new java.lang.String(chars,start,length)+'';
26696
+ }
26697
+ return chars;
26698
+ }
26699
+ }
26700
+
26701
+ /*
26702
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
26703
+ * used method of org.xml.sax.ext.LexicalHandler:
26704
+ * #comment(chars, start, length)
26705
+ * #startCDATA()
26706
+ * #endCDATA()
26707
+ * #startDTD(name, publicId, systemId)
26708
+ *
26709
+ *
26710
+ * IGNORED method of org.xml.sax.ext.LexicalHandler:
26711
+ * #endDTD()
26712
+ * #startEntity(name)
26713
+ * #endEntity(name)
26714
+ *
26715
+ *
26716
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
26717
+ * IGNORED method of org.xml.sax.ext.DeclHandler
26718
+ * #attributeDecl(eName, aName, type, mode, value)
26719
+ * #elementDecl(name, model)
26720
+ * #externalEntityDecl(name, publicId, systemId)
26721
+ * #internalEntityDecl(name, value)
26722
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
26723
+ * IGNORED method of org.xml.sax.EntityResolver2
26724
+ * #resolveEntity(String name,String publicId,String baseURI,String systemId)
26725
+ * #resolveEntity(publicId, systemId)
26726
+ * #getExternalSubset(name, baseURI)
26727
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
26728
+ * IGNORED method of org.xml.sax.DTDHandler
26729
+ * #notationDecl(name, publicId, systemId) {};
26730
+ * #unparsedEntityDecl(name, publicId, systemId, notationName) {};
26731
+ */
26732
+ "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
26733
+ DOMHandler.prototype[key] = function(){return null}
26734
+ })
26735
+
26736
+ /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
26737
+ function appendElement (hander,node) {
26738
+ if (!hander.currentElement) {
26739
+ hander.doc.appendChild(node);
26740
+ } else {
26741
+ hander.currentElement.appendChild(node);
26742
+ }
26743
+ }//appendChild and setAttributeNS are preformance key
26744
+
26745
+ exports.__DOMHandler = DOMHandler;
26746
+ exports.normalizeLineEndings = normalizeLineEndings;
26747
+ exports.DOMParser = DOMParser;
26748
+
26749
+
26750
+ /***/ }),
26751
+
26752
+ /***/ "./node_modules/@xmldom/xmldom/lib/dom.js":
26753
+ /*!************************************************!*\
26754
+ !*** ./node_modules/@xmldom/xmldom/lib/dom.js ***!
26755
+ \************************************************/
26756
+ /*! no static exports found */
26757
+ /***/ (function(module, exports, __webpack_require__) {
26758
+
26759
+ var conventions = __webpack_require__(/*! ./conventions */ "./node_modules/@xmldom/xmldom/lib/conventions.js");
26760
+
26761
+ var NAMESPACE = conventions.NAMESPACE;
26762
+
26763
+ /**
26764
+ * A prerequisite for `[].filter`, to drop elements that are empty
26765
+ * @param {string} input
26766
+ * @returns {boolean}
26767
+ */
26768
+ function notEmptyString (input) {
26769
+ return input !== ''
26770
+ }
26771
+ /**
26772
+ * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
26773
+ * @see https://infra.spec.whatwg.org/#ascii-whitespace
26774
+ *
26775
+ * @param {string} input
26776
+ * @returns {string[]} (can be empty)
26777
+ */
26778
+ function splitOnASCIIWhitespace(input) {
26779
+ // U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE
26780
+ return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []
26781
+ }
26782
+
26783
+ /**
26784
+ * Adds element as a key to current if it is not already present.
26785
+ *
26786
+ * @param {Record<string, boolean | undefined>} current
26787
+ * @param {string} element
26788
+ * @returns {Record<string, boolean | undefined>}
26789
+ */
26790
+ function orderedSetReducer (current, element) {
26791
+ if (!current.hasOwnProperty(element)) {
26792
+ current[element] = true;
26793
+ }
26794
+ return current;
26795
+ }
26796
+
26797
+ /**
26798
+ * @see https://infra.spec.whatwg.org/#ordered-set
26799
+ * @param {string} input
26800
+ * @returns {string[]}
26801
+ */
26802
+ function toOrderedSet(input) {
26803
+ if (!input) return [];
26804
+ var list = splitOnASCIIWhitespace(input);
26805
+ return Object.keys(list.reduce(orderedSetReducer, {}))
26806
+ }
26807
+
26808
+ /**
26809
+ * Uses `list.indexOf` to implement something like `Array.prototype.includes`,
26810
+ * which we can not rely on being available.
26811
+ *
26812
+ * @param {any[]} list
26813
+ * @returns {function(any): boolean}
26814
+ */
26815
+ function arrayIncludes (list) {
26816
+ return function(element) {
26817
+ return list && list.indexOf(element) !== -1;
26818
+ }
26819
+ }
26820
+
26821
+ function copy(src,dest){
26822
+ for(var p in src){
26823
+ dest[p] = src[p];
26824
+ }
26825
+ }
26826
+
26827
+ /**
26828
+ ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
26829
+ ^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
26830
+ */
26831
+ function _extends(Class,Super){
26832
+ var pt = Class.prototype;
26833
+ if(!(pt instanceof Super)){
26834
+ function t(){};
26835
+ t.prototype = Super.prototype;
26836
+ t = new t();
26837
+ copy(pt,t);
26838
+ Class.prototype = pt = t;
26839
+ }
26840
+ if(pt.constructor != Class){
26841
+ if(typeof Class != 'function'){
26842
+ console.error("unknown Class:"+Class)
26843
+ }
26844
+ pt.constructor = Class
26845
+ }
26846
+ }
26847
+
26848
+ // Node Types
26849
+ var NodeType = {}
26850
+ var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
26851
+ var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
26852
+ var TEXT_NODE = NodeType.TEXT_NODE = 3;
26853
+ var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
26854
+ var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
26855
+ var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
26856
+ var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
26857
+ var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
26858
+ var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
26859
+ var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
26860
+ var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
26861
+ var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
26862
+
26863
+ // ExceptionCode
26864
+ var ExceptionCode = {}
26865
+ var ExceptionMessage = {};
26866
+ var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1);
26867
+ var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
26868
+ var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
26869
+ var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
26870
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
26871
+ var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
26872
+ var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
26873
+ var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
26874
+ var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
26875
+ var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
26876
+ //level2
26877
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
26878
+ var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
26879
+ var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
26880
+ var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
26881
+ var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15);
26882
+
26883
+ /**
26884
+ * DOM Level 2
26885
+ * Object DOMException
26886
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
26887
+ * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
26888
+ */
26889
+ function DOMException(code, message) {
26890
+ if(message instanceof Error){
26891
+ var error = message;
26892
+ }else{
26893
+ error = this;
26894
+ Error.call(this, ExceptionMessage[code]);
26895
+ this.message = ExceptionMessage[code];
26896
+ if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
26897
+ }
26898
+ error.code = code;
26899
+ if(message) this.message = this.message + ": " + message;
26900
+ return error;
26901
+ };
26902
+ DOMException.prototype = Error.prototype;
26903
+ copy(ExceptionCode,DOMException)
26904
+
26905
+ /**
26906
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
26907
+ * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
26908
+ * The items in the NodeList are accessible via an integral index, starting from 0.
26909
+ */
26910
+ function NodeList() {
26911
+ };
26912
+ NodeList.prototype = {
26913
+ /**
26914
+ * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
26915
+ * @standard level1
26916
+ */
26917
+ length:0,
26918
+ /**
26919
+ * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
26920
+ * @standard level1
26921
+ * @param index unsigned long
26922
+ * Index into the collection.
26923
+ * @return Node
26924
+ * The node at the indexth position in the NodeList, or null if that is not a valid index.
26925
+ */
26926
+ item: function(index) {
26927
+ return this[index] || null;
26928
+ },
26929
+ toString:function(isHTML,nodeFilter){
26930
+ for(var buf = [], i = 0;i<this.length;i++){
26931
+ serializeToString(this[i],buf,isHTML,nodeFilter);
26932
+ }
26933
+ return buf.join('');
26934
+ }
26935
+ };
26936
+
26937
+ function LiveNodeList(node,refresh){
26938
+ this._node = node;
26939
+ this._refresh = refresh
26940
+ _updateLiveList(this);
26941
+ }
26942
+ function _updateLiveList(list){
26943
+ var inc = list._node._inc || list._node.ownerDocument._inc;
26944
+ if(list._inc != inc){
26945
+ var ls = list._refresh(list._node);
26946
+ //console.log(ls.length)
26947
+ __set__(list,'length',ls.length);
26948
+ copy(ls,list);
26949
+ list._inc = inc;
26950
+ }
26951
+ }
26952
+ LiveNodeList.prototype.item = function(i){
26953
+ _updateLiveList(this);
26954
+ return this[i];
26955
+ }
26956
+
26957
+ _extends(LiveNodeList,NodeList);
26958
+
26959
+ /**
26960
+ * Objects implementing the NamedNodeMap interface are used
26961
+ * to represent collections of nodes that can be accessed by name.
26962
+ * Note that NamedNodeMap does not inherit from NodeList;
26963
+ * NamedNodeMaps are not maintained in any particular order.
26964
+ * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
26965
+ * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
26966
+ * and does not imply that the DOM specifies an order to these Nodes.
26967
+ * NamedNodeMap objects in the DOM are live.
26968
+ * used for attributes or DocumentType entities
26969
+ */
26970
+ function NamedNodeMap() {
26971
+ };
26972
+
26973
+ function _findNodeIndex(list,node){
26974
+ var i = list.length;
26975
+ while(i--){
26976
+ if(list[i] === node){return i}
26977
+ }
26978
+ }
26979
+
26980
+ function _addNamedNode(el,list,newAttr,oldAttr){
26981
+ if(oldAttr){
26982
+ list[_findNodeIndex(list,oldAttr)] = newAttr;
26983
+ }else{
26984
+ list[list.length++] = newAttr;
26985
+ }
26986
+ if(el){
26987
+ newAttr.ownerElement = el;
26988
+ var doc = el.ownerDocument;
26989
+ if(doc){
26990
+ oldAttr && _onRemoveAttribute(doc,el,oldAttr);
26991
+ _onAddAttribute(doc,el,newAttr);
26992
+ }
26993
+ }
26994
+ }
26995
+ function _removeNamedNode(el,list,attr){
26996
+ //console.log('remove attr:'+attr)
26997
+ var i = _findNodeIndex(list,attr);
26998
+ if(i>=0){
26999
+ var lastIndex = list.length-1
27000
+ while(i<lastIndex){
27001
+ list[i] = list[++i]
27002
+ }
27003
+ list.length = lastIndex;
27004
+ if(el){
27005
+ var doc = el.ownerDocument;
27006
+ if(doc){
27007
+ _onRemoveAttribute(doc,el,attr);
27008
+ attr.ownerElement = null;
27009
+ }
27010
+ }
27011
+ }else{
27012
+ throw DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))
27013
+ }
27014
+ }
27015
+ NamedNodeMap.prototype = {
27016
+ length:0,
27017
+ item:NodeList.prototype.item,
27018
+ getNamedItem: function(key) {
27019
+ // if(key.indexOf(':')>0 || key == 'xmlns'){
27020
+ // return null;
27021
+ // }
27022
+ //console.log()
27023
+ var i = this.length;
27024
+ while(i--){
27025
+ var attr = this[i];
27026
+ //console.log(attr.nodeName,key)
27027
+ if(attr.nodeName == key){
27028
+ return attr;
27029
+ }
27030
+ }
27031
+ },
27032
+ setNamedItem: function(attr) {
27033
+ var el = attr.ownerElement;
27034
+ if(el && el!=this._ownerElement){
27035
+ throw new DOMException(INUSE_ATTRIBUTE_ERR);
27036
+ }
27037
+ var oldAttr = this.getNamedItem(attr.nodeName);
27038
+ _addNamedNode(this._ownerElement,this,attr,oldAttr);
27039
+ return oldAttr;
27040
+ },
27041
+ /* returns Node */
27042
+ setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR
27043
+ var el = attr.ownerElement, oldAttr;
27044
+ if(el && el!=this._ownerElement){
27045
+ throw new DOMException(INUSE_ATTRIBUTE_ERR);
27046
+ }
27047
+ oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);
27048
+ _addNamedNode(this._ownerElement,this,attr,oldAttr);
27049
+ return oldAttr;
27050
+ },
27051
+
27052
+ /* returns Node */
27053
+ removeNamedItem: function(key) {
27054
+ var attr = this.getNamedItem(key);
27055
+ _removeNamedNode(this._ownerElement,this,attr);
27056
+ return attr;
27057
+
27058
+
27059
+ },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
27060
+
27061
+ //for level2
27062
+ removeNamedItemNS:function(namespaceURI,localName){
27063
+ var attr = this.getNamedItemNS(namespaceURI,localName);
27064
+ _removeNamedNode(this._ownerElement,this,attr);
27065
+ return attr;
27066
+ },
27067
+ getNamedItemNS: function(namespaceURI, localName) {
27068
+ var i = this.length;
27069
+ while(i--){
27070
+ var node = this[i];
27071
+ if(node.localName == localName && node.namespaceURI == namespaceURI){
27072
+ return node;
27073
+ }
27074
+ }
27075
+ return null;
27076
+ }
27077
+ };
27078
+
27079
+ /**
27080
+ * The DOMImplementation interface represents an object providing methods
27081
+ * which are not dependent on any particular document.
27082
+ * Such an object is returned by the `Document.implementation` property.
27083
+ *
27084
+ * __The individual methods describe the differences compared to the specs.__
27085
+ *
27086
+ * @constructor
27087
+ *
27088
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
27089
+ * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
27090
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
27091
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
27092
+ * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
27093
+ */
27094
+ function DOMImplementation() {
27095
+ }
27096
+
27097
+ DOMImplementation.prototype = {
27098
+ /**
27099
+ * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
27100
+ * The different implementations fairly diverged in what kind of features were reported.
27101
+ * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
27102
+ *
27103
+ * @deprecated It is deprecated and modern browsers return true in all cases.
27104
+ *
27105
+ * @param {string} feature
27106
+ * @param {string} [version]
27107
+ * @returns {boolean} always true
27108
+ *
27109
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
27110
+ * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
27111
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
27112
+ */
27113
+ hasFeature: function(feature, version) {
27114
+ return true;
27115
+ },
27116
+ /**
27117
+ * Creates an XML Document object of the specified type with its document element.
27118
+ *
27119
+ * __It behaves slightly different from the description in the living standard__:
27120
+ * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
27121
+ * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
27122
+ * - this implementation is not validating names or qualified names
27123
+ * (when parsing XML strings, the SAX parser takes care of that)
27124
+ *
27125
+ * @param {string|null} namespaceURI
27126
+ * @param {string} qualifiedName
27127
+ * @param {DocumentType=null} doctype
27128
+ * @returns {Document}
27129
+ *
27130
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
27131
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
27132
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
27133
+ *
27134
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
27135
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
27136
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
27137
+ */
27138
+ createDocument: function(namespaceURI, qualifiedName, doctype){
27139
+ var doc = new Document();
27140
+ doc.implementation = this;
27141
+ doc.childNodes = new NodeList();
27142
+ doc.doctype = doctype || null;
27143
+ if (doctype){
27144
+ doc.appendChild(doctype);
27145
+ }
27146
+ if (qualifiedName){
27147
+ var root = doc.createElementNS(namespaceURI, qualifiedName);
27148
+ doc.appendChild(root);
27149
+ }
27150
+ return doc;
27151
+ },
27152
+ /**
27153
+ * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
27154
+ *
27155
+ * __This behavior is slightly different from the in the specs__:
27156
+ * - this implementation is not validating names or qualified names
27157
+ * (when parsing XML strings, the SAX parser takes care of that)
27158
+ *
27159
+ * @param {string} qualifiedName
27160
+ * @param {string} [publicId]
27161
+ * @param {string} [systemId]
27162
+ * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
27163
+ * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
27164
+ *
27165
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
27166
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
27167
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
27168
+ *
27169
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
27170
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
27171
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
27172
+ */
27173
+ createDocumentType: function(qualifiedName, publicId, systemId){
27174
+ var node = new DocumentType();
27175
+ node.name = qualifiedName;
27176
+ node.nodeName = qualifiedName;
27177
+ node.publicId = publicId || '';
27178
+ node.systemId = systemId || '';
27179
+
27180
+ return node;
27181
+ }
27182
+ };
27183
+
27184
+
27185
+ /**
27186
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
27187
+ */
27188
+
27189
+ function Node() {
27190
+ };
27191
+
27192
+ Node.prototype = {
27193
+ firstChild : null,
27194
+ lastChild : null,
27195
+ previousSibling : null,
27196
+ nextSibling : null,
27197
+ attributes : null,
27198
+ parentNode : null,
27199
+ childNodes : null,
27200
+ ownerDocument : null,
27201
+ nodeValue : null,
27202
+ namespaceURI : null,
27203
+ prefix : null,
27204
+ localName : null,
27205
+ // Modified in DOM Level 2:
27206
+ insertBefore:function(newChild, refChild){//raises
27207
+ return _insertBefore(this,newChild,refChild);
27208
+ },
27209
+ replaceChild:function(newChild, oldChild){//raises
27210
+ this.insertBefore(newChild,oldChild);
27211
+ if(oldChild){
27212
+ this.removeChild(oldChild);
27213
+ }
27214
+ },
27215
+ removeChild:function(oldChild){
27216
+ return _removeChild(this,oldChild);
27217
+ },
27218
+ appendChild:function(newChild){
27219
+ return this.insertBefore(newChild,null);
27220
+ },
27221
+ hasChildNodes:function(){
27222
+ return this.firstChild != null;
27223
+ },
27224
+ cloneNode:function(deep){
27225
+ return cloneNode(this.ownerDocument||this,this,deep);
27226
+ },
27227
+ // Modified in DOM Level 2:
27228
+ normalize:function(){
27229
+ var child = this.firstChild;
27230
+ while(child){
27231
+ var next = child.nextSibling;
27232
+ if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
27233
+ this.removeChild(next);
27234
+ child.appendData(next.data);
27235
+ }else{
27236
+ child.normalize();
27237
+ child = next;
27238
+ }
27239
+ }
27240
+ },
27241
+ // Introduced in DOM Level 2:
27242
+ isSupported:function(feature, version){
27243
+ return this.ownerDocument.implementation.hasFeature(feature,version);
27244
+ },
27245
+ // Introduced in DOM Level 2:
27246
+ hasAttributes:function(){
27247
+ return this.attributes.length>0;
27248
+ },
27249
+ /**
27250
+ * Look up the prefix associated to the given namespace URI, starting from this node.
27251
+ * **The default namespace declarations are ignored by this method.**
27252
+ * See Namespace Prefix Lookup for details on the algorithm used by this method.
27253
+ *
27254
+ * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
27255
+ *
27256
+ * @param {string | null} namespaceURI
27257
+ * @returns {string | null}
27258
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
27259
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
27260
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
27261
+ * @see https://github.com/xmldom/xmldom/issues/322
27262
+ */
27263
+ lookupPrefix:function(namespaceURI){
27264
+ var el = this;
27265
+ while(el){
27266
+ var map = el._nsMap;
27267
+ //console.dir(map)
27268
+ if(map){
27269
+ for(var n in map){
27270
+ if(map[n] == namespaceURI){
27271
+ return n;
27272
+ }
27273
+ }
27274
+ }
27275
+ el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
27276
+ }
27277
+ return null;
27278
+ },
27279
+ // Introduced in DOM Level 3:
27280
+ lookupNamespaceURI:function(prefix){
27281
+ var el = this;
27282
+ while(el){
27283
+ var map = el._nsMap;
27284
+ //console.dir(map)
27285
+ if(map){
27286
+ if(prefix in map){
27287
+ return map[prefix] ;
27288
+ }
27289
+ }
27290
+ el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
27291
+ }
27292
+ return null;
27293
+ },
27294
+ // Introduced in DOM Level 3:
27295
+ isDefaultNamespace:function(namespaceURI){
27296
+ var prefix = this.lookupPrefix(namespaceURI);
27297
+ return prefix == null;
27298
+ }
27299
+ };
27300
+
27301
+
27302
+ function _xmlEncoder(c){
27303
+ return c == '<' && '&lt;' ||
27304
+ c == '>' && '&gt;' ||
27305
+ c == '&' && '&amp;' ||
27306
+ c == '"' && '&quot;' ||
27307
+ '&#'+c.charCodeAt()+';'
27308
+ }
27309
+
27310
+
27311
+ copy(NodeType,Node);
27312
+ copy(NodeType,Node.prototype);
27313
+
27314
+ /**
27315
+ * @param callback return true for continue,false for break
27316
+ * @return boolean true: break visit;
27317
+ */
27318
+ function _visitNode(node,callback){
27319
+ if(callback(node)){
27320
+ return true;
27321
+ }
27322
+ if(node = node.firstChild){
27323
+ do{
27324
+ if(_visitNode(node,callback)){return true}
27325
+ }while(node=node.nextSibling)
27326
+ }
27327
+ }
27328
+
27329
+
27330
+
27331
+ function Document(){
27332
+ }
27333
+
27334
+ function _onAddAttribute(doc,el,newAttr){
27335
+ doc && doc._inc++;
27336
+ var ns = newAttr.namespaceURI ;
27337
+ if(ns === NAMESPACE.XMLNS){
27338
+ //update namespace
27339
+ el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value
27340
+ }
27341
+ }
27342
+
27343
+ function _onRemoveAttribute(doc,el,newAttr,remove){
27344
+ doc && doc._inc++;
27345
+ var ns = newAttr.namespaceURI ;
27346
+ if(ns === NAMESPACE.XMLNS){
27347
+ //update namespace
27348
+ delete el._nsMap[newAttr.prefix?newAttr.localName:'']
27349
+ }
27350
+ }
27351
+
27352
+ /**
27353
+ * Updates `el.childNodes`, updating the indexed items and it's `length`.
27354
+ * Passing `newChild` means it will be appended.
27355
+ * Otherwise it's assumed that an item has been removed,
27356
+ * and `el.firstNode` and it's `.nextSibling` are used
27357
+ * to walk the current list of child nodes.
27358
+ *
27359
+ * @param {Document} doc
27360
+ * @param {Node} el
27361
+ * @param {Node} [newChild]
27362
+ * @private
27363
+ */
27364
+ function _onUpdateChild (doc, el, newChild) {
27365
+ if(doc && doc._inc){
27366
+ doc._inc++;
27367
+ //update childNodes
27368
+ var cs = el.childNodes;
27369
+ if (newChild) {
27370
+ cs[cs.length++] = newChild;
27371
+ } else {
27372
+ var child = el.firstChild;
27373
+ var i = 0;
27374
+ while (child) {
27375
+ cs[i++] = child;
27376
+ child = child.nextSibling;
27377
+ }
27378
+ cs.length = i;
27379
+ delete cs[cs.length];
27380
+ }
27381
+ }
27382
+ }
27383
+
27384
+ /**
27385
+ * Removes the connections between `parentNode` and `child`
27386
+ * and any existing `child.previousSibling` or `child.nextSibling`.
27387
+ *
27388
+ * @see https://github.com/xmldom/xmldom/issues/135
27389
+ * @see https://github.com/xmldom/xmldom/issues/145
27390
+ *
27391
+ * @param {Node} parentNode
27392
+ * @param {Node} child
27393
+ * @returns {Node} the child that was removed.
27394
+ * @private
27395
+ */
27396
+ function _removeChild (parentNode, child) {
27397
+ var previous = child.previousSibling;
27398
+ var next = child.nextSibling;
27399
+ if (previous) {
27400
+ previous.nextSibling = next;
27401
+ } else {
27402
+ parentNode.firstChild = next;
27403
+ }
27404
+ if (next) {
27405
+ next.previousSibling = previous;
27406
+ } else {
27407
+ parentNode.lastChild = previous;
27408
+ }
27409
+ child.parentNode = null;
27410
+ child.previousSibling = null;
27411
+ child.nextSibling = null;
27412
+ _onUpdateChild(parentNode.ownerDocument, parentNode);
27413
+ return child;
27414
+ }
27415
+ /**
27416
+ * preformance key(refChild == null)
27417
+ */
27418
+ function _insertBefore(parentNode,newChild,nextChild){
27419
+ var cp = newChild.parentNode;
27420
+ if(cp){
27421
+ cp.removeChild(newChild);//remove and update
27422
+ }
27423
+ if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
27424
+ var newFirst = newChild.firstChild;
27425
+ if (newFirst == null) {
27426
+ return newChild;
27427
+ }
27428
+ var newLast = newChild.lastChild;
27429
+ }else{
27430
+ newFirst = newLast = newChild;
27431
+ }
27432
+ var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild;
27433
+
27434
+ newFirst.previousSibling = pre;
27435
+ newLast.nextSibling = nextChild;
27436
+
27437
+
27438
+ if(pre){
27439
+ pre.nextSibling = newFirst;
27440
+ }else{
27441
+ parentNode.firstChild = newFirst;
27442
+ }
27443
+ if(nextChild == null){
27444
+ parentNode.lastChild = newLast;
27445
+ }else{
27446
+ nextChild.previousSibling = newLast;
27447
+ }
27448
+ do{
27449
+ newFirst.parentNode = parentNode;
27450
+ }while(newFirst !== newLast && (newFirst= newFirst.nextSibling))
27451
+ _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode);
27452
+ //console.log(parentNode.lastChild.nextSibling == null)
27453
+ if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
27454
+ newChild.firstChild = newChild.lastChild = null;
27455
+ }
27456
+ return newChild;
27457
+ }
27458
+
27459
+ /**
27460
+ * Appends `newChild` to `parentNode`.
27461
+ * If `newChild` is already connected to a `parentNode` it is first removed from it.
27462
+ *
27463
+ * @see https://github.com/xmldom/xmldom/issues/135
27464
+ * @see https://github.com/xmldom/xmldom/issues/145
27465
+ * @param {Node} parentNode
27466
+ * @param {Node} newChild
27467
+ * @returns {Node}
27468
+ * @private
27469
+ */
27470
+ function _appendSingleChild (parentNode, newChild) {
27471
+ if (newChild.parentNode) {
27472
+ newChild.parentNode.removeChild(newChild);
27473
+ }
27474
+ newChild.parentNode = parentNode;
27475
+ newChild.previousSibling = parentNode.lastChild;
27476
+ newChild.nextSibling = null;
27477
+ if (newChild.previousSibling) {
27478
+ newChild.previousSibling.nextSibling = newChild;
27479
+ } else {
27480
+ parentNode.firstChild = newChild;
27481
+ }
27482
+ parentNode.lastChild = newChild;
27483
+ _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
27484
+ return newChild;
27485
+ }
27486
+
27487
+ Document.prototype = {
27488
+ //implementation : null,
27489
+ nodeName : '#document',
27490
+ nodeType : DOCUMENT_NODE,
27491
+ /**
27492
+ * The DocumentType node of the document.
27493
+ *
27494
+ * @readonly
27495
+ * @type DocumentType
27496
+ */
27497
+ doctype : null,
27498
+ documentElement : null,
27499
+ _inc : 1,
27500
+
27501
+ insertBefore : function(newChild, refChild){//raises
27502
+ if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){
27503
+ var child = newChild.firstChild;
27504
+ while(child){
27505
+ var next = child.nextSibling;
27506
+ this.insertBefore(child,refChild);
27507
+ child = next;
27508
+ }
27509
+ return newChild;
27510
+ }
27511
+ if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
27512
+ this.documentElement = newChild;
27513
+ }
27514
+
27515
+ return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild;
27516
+ },
27517
+ removeChild : function(oldChild){
27518
+ if(this.documentElement == oldChild){
27519
+ this.documentElement = null;
27520
+ }
27521
+ return _removeChild(this,oldChild);
27522
+ },
27523
+ // Introduced in DOM Level 2:
27524
+ importNode : function(importedNode,deep){
27525
+ return importNode(this,importedNode,deep);
27526
+ },
27527
+ // Introduced in DOM Level 2:
27528
+ getElementById : function(id){
27529
+ var rtv = null;
27530
+ _visitNode(this.documentElement,function(node){
27531
+ if(node.nodeType == ELEMENT_NODE){
27532
+ if(node.getAttribute('id') == id){
27533
+ rtv = node;
27534
+ return true;
27535
+ }
27536
+ }
27537
+ })
27538
+ return rtv;
27539
+ },
27540
+
27541
+ /**
27542
+ * The `getElementsByClassName` method of `Document` interface returns an array-like object
27543
+ * of all child elements which have **all** of the given class name(s).
27544
+ *
27545
+ * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
27546
+ *
27547
+ *
27548
+ * Warning: This is a live LiveNodeList.
27549
+ * Changes in the DOM will reflect in the array as the changes occur.
27550
+ * If an element selected by this array no longer qualifies for the selector,
27551
+ * it will automatically be removed. Be aware of this for iteration purposes.
27552
+ *
27553
+ * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
27554
+ *
27555
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
27556
+ * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
27557
+ */
27558
+ getElementsByClassName: function(classNames) {
27559
+ var classNamesSet = toOrderedSet(classNames)
27560
+ return new LiveNodeList(this, function(base) {
27561
+ var ls = [];
27562
+ if (classNamesSet.length > 0) {
27563
+ _visitNode(base.documentElement, function(node) {
27564
+ if(node !== base && node.nodeType === ELEMENT_NODE) {
27565
+ var nodeClassNames = node.getAttribute('class')
27566
+ // can be null if the attribute does not exist
27567
+ if (nodeClassNames) {
27568
+ // before splitting and iterating just compare them for the most common case
27569
+ var matches = classNames === nodeClassNames;
27570
+ if (!matches) {
27571
+ var nodeClassNamesSet = toOrderedSet(nodeClassNames)
27572
+ matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))
27573
+ }
27574
+ if(matches) {
27575
+ ls.push(node);
27576
+ }
27577
+ }
27578
+ }
27579
+ });
27580
+ }
27581
+ return ls;
27582
+ });
27583
+ },
27584
+
27585
+ //document factory method:
27586
+ createElement : function(tagName){
27587
+ var node = new Element();
27588
+ node.ownerDocument = this;
27589
+ node.nodeName = tagName;
27590
+ node.tagName = tagName;
27591
+ node.localName = tagName;
27592
+ node.childNodes = new NodeList();
27593
+ var attrs = node.attributes = new NamedNodeMap();
27594
+ attrs._ownerElement = node;
27595
+ return node;
27596
+ },
27597
+ createDocumentFragment : function(){
27598
+ var node = new DocumentFragment();
27599
+ node.ownerDocument = this;
27600
+ node.childNodes = new NodeList();
27601
+ return node;
27602
+ },
27603
+ createTextNode : function(data){
27604
+ var node = new Text();
27605
+ node.ownerDocument = this;
27606
+ node.appendData(data)
27607
+ return node;
27608
+ },
27609
+ createComment : function(data){
27610
+ var node = new Comment();
27611
+ node.ownerDocument = this;
27612
+ node.appendData(data)
27613
+ return node;
27614
+ },
27615
+ createCDATASection : function(data){
27616
+ var node = new CDATASection();
27617
+ node.ownerDocument = this;
27618
+ node.appendData(data)
27619
+ return node;
27620
+ },
27621
+ createProcessingInstruction : function(target,data){
27622
+ var node = new ProcessingInstruction();
27623
+ node.ownerDocument = this;
27624
+ node.tagName = node.target = target;
27625
+ node.nodeValue= node.data = data;
27626
+ return node;
27627
+ },
27628
+ createAttribute : function(name){
27629
+ var node = new Attr();
27630
+ node.ownerDocument = this;
27631
+ node.name = name;
27632
+ node.nodeName = name;
27633
+ node.localName = name;
27634
+ node.specified = true;
27635
+ return node;
27636
+ },
27637
+ createEntityReference : function(name){
27638
+ var node = new EntityReference();
27639
+ node.ownerDocument = this;
27640
+ node.nodeName = name;
27641
+ return node;
27642
+ },
27643
+ // Introduced in DOM Level 2:
27644
+ createElementNS : function(namespaceURI,qualifiedName){
27645
+ var node = new Element();
27646
+ var pl = qualifiedName.split(':');
27647
+ var attrs = node.attributes = new NamedNodeMap();
27648
+ node.childNodes = new NodeList();
27649
+ node.ownerDocument = this;
27650
+ node.nodeName = qualifiedName;
27651
+ node.tagName = qualifiedName;
27652
+ node.namespaceURI = namespaceURI;
27653
+ if(pl.length == 2){
27654
+ node.prefix = pl[0];
27655
+ node.localName = pl[1];
27656
+ }else{
27657
+ //el.prefix = null;
27658
+ node.localName = qualifiedName;
27659
+ }
27660
+ attrs._ownerElement = node;
27661
+ return node;
27662
+ },
27663
+ // Introduced in DOM Level 2:
27664
+ createAttributeNS : function(namespaceURI,qualifiedName){
27665
+ var node = new Attr();
27666
+ var pl = qualifiedName.split(':');
27667
+ node.ownerDocument = this;
27668
+ node.nodeName = qualifiedName;
27669
+ node.name = qualifiedName;
27670
+ node.namespaceURI = namespaceURI;
27671
+ node.specified = true;
27672
+ if(pl.length == 2){
27673
+ node.prefix = pl[0];
27674
+ node.localName = pl[1];
27675
+ }else{
27676
+ //el.prefix = null;
27677
+ node.localName = qualifiedName;
27678
+ }
27679
+ return node;
27680
+ }
27681
+ };
27682
+ _extends(Document,Node);
27683
+
27684
+
27685
+ function Element() {
27686
+ this._nsMap = {};
27687
+ };
27688
+ Element.prototype = {
27689
+ nodeType : ELEMENT_NODE,
27690
+ hasAttribute : function(name){
27691
+ return this.getAttributeNode(name)!=null;
27692
+ },
27693
+ getAttribute : function(name){
27694
+ var attr = this.getAttributeNode(name);
27695
+ return attr && attr.value || '';
27696
+ },
27697
+ getAttributeNode : function(name){
27698
+ return this.attributes.getNamedItem(name);
27699
+ },
27700
+ setAttribute : function(name, value){
27701
+ var attr = this.ownerDocument.createAttribute(name);
27702
+ attr.value = attr.nodeValue = "" + value;
27703
+ this.setAttributeNode(attr)
27704
+ },
27705
+ removeAttribute : function(name){
27706
+ var attr = this.getAttributeNode(name)
27707
+ attr && this.removeAttributeNode(attr);
27708
+ },
27709
+
27710
+ //four real opeartion method
27711
+ appendChild:function(newChild){
27712
+ if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
27713
+ return this.insertBefore(newChild,null);
27714
+ }else{
27715
+ return _appendSingleChild(this,newChild);
27716
+ }
27717
+ },
27718
+ setAttributeNode : function(newAttr){
27719
+ return this.attributes.setNamedItem(newAttr);
27720
+ },
27721
+ setAttributeNodeNS : function(newAttr){
27722
+ return this.attributes.setNamedItemNS(newAttr);
27723
+ },
27724
+ removeAttributeNode : function(oldAttr){
27725
+ //console.log(this == oldAttr.ownerElement)
27726
+ return this.attributes.removeNamedItem(oldAttr.nodeName);
27727
+ },
27728
+ //get real attribute name,and remove it by removeAttributeNode
27729
+ removeAttributeNS : function(namespaceURI, localName){
27730
+ var old = this.getAttributeNodeNS(namespaceURI, localName);
27731
+ old && this.removeAttributeNode(old);
27732
+ },
27733
+
27734
+ hasAttributeNS : function(namespaceURI, localName){
27735
+ return this.getAttributeNodeNS(namespaceURI, localName)!=null;
27736
+ },
27737
+ getAttributeNS : function(namespaceURI, localName){
27738
+ var attr = this.getAttributeNodeNS(namespaceURI, localName);
27739
+ return attr && attr.value || '';
27740
+ },
27741
+ setAttributeNS : function(namespaceURI, qualifiedName, value){
27742
+ var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
27743
+ attr.value = attr.nodeValue = "" + value;
27744
+ this.setAttributeNode(attr)
27745
+ },
27746
+ getAttributeNodeNS : function(namespaceURI, localName){
27747
+ return this.attributes.getNamedItemNS(namespaceURI, localName);
27748
+ },
27749
+
27750
+ getElementsByTagName : function(tagName){
27751
+ return new LiveNodeList(this,function(base){
27752
+ var ls = [];
27753
+ _visitNode(base,function(node){
27754
+ if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){
27755
+ ls.push(node);
27756
+ }
27757
+ });
27758
+ return ls;
27759
+ });
27760
+ },
27761
+ getElementsByTagNameNS : function(namespaceURI, localName){
27762
+ return new LiveNodeList(this,function(base){
27763
+ var ls = [];
27764
+ _visitNode(base,function(node){
27765
+ if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){
27766
+ ls.push(node);
27767
+ }
27768
+ });
27769
+ return ls;
27770
+
27771
+ });
27772
+ }
27773
+ };
27774
+ Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
27775
+ Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
27776
+
27777
+
27778
+ _extends(Element,Node);
27779
+ function Attr() {
27780
+ };
27781
+ Attr.prototype.nodeType = ATTRIBUTE_NODE;
27782
+ _extends(Attr,Node);
27783
+
27784
+
27785
+ function CharacterData() {
27786
+ };
27787
+ CharacterData.prototype = {
27788
+ data : '',
27789
+ substringData : function(offset, count) {
27790
+ return this.data.substring(offset, offset+count);
27791
+ },
27792
+ appendData: function(text) {
27793
+ text = this.data+text;
27794
+ this.nodeValue = this.data = text;
27795
+ this.length = text.length;
27796
+ },
27797
+ insertData: function(offset,text) {
27798
+ this.replaceData(offset,0,text);
27799
+
27800
+ },
27801
+ appendChild:function(newChild){
27802
+ throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])
27803
+ },
27804
+ deleteData: function(offset, count) {
27805
+ this.replaceData(offset,count,"");
27806
+ },
27807
+ replaceData: function(offset, count, text) {
27808
+ var start = this.data.substring(0,offset);
27809
+ var end = this.data.substring(offset+count);
27810
+ text = start + text + end;
27811
+ this.nodeValue = this.data = text;
27812
+ this.length = text.length;
27813
+ }
27814
+ }
27815
+ _extends(CharacterData,Node);
27816
+ function Text() {
27817
+ };
27818
+ Text.prototype = {
27819
+ nodeName : "#text",
27820
+ nodeType : TEXT_NODE,
27821
+ splitText : function(offset) {
27822
+ var text = this.data;
27823
+ var newText = text.substring(offset);
27824
+ text = text.substring(0, offset);
27825
+ this.data = this.nodeValue = text;
27826
+ this.length = text.length;
27827
+ var newNode = this.ownerDocument.createTextNode(newText);
27828
+ if(this.parentNode){
27829
+ this.parentNode.insertBefore(newNode, this.nextSibling);
27830
+ }
27831
+ return newNode;
27832
+ }
27833
+ }
27834
+ _extends(Text,CharacterData);
27835
+ function Comment() {
27836
+ };
27837
+ Comment.prototype = {
27838
+ nodeName : "#comment",
27839
+ nodeType : COMMENT_NODE
27840
+ }
27841
+ _extends(Comment,CharacterData);
27842
+
27843
+ function CDATASection() {
27844
+ };
27845
+ CDATASection.prototype = {
27846
+ nodeName : "#cdata-section",
27847
+ nodeType : CDATA_SECTION_NODE
27848
+ }
27849
+ _extends(CDATASection,CharacterData);
27850
+
27851
+
27852
+ function DocumentType() {
27853
+ };
27854
+ DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
27855
+ _extends(DocumentType,Node);
27856
+
27857
+ function Notation() {
27858
+ };
27859
+ Notation.prototype.nodeType = NOTATION_NODE;
27860
+ _extends(Notation,Node);
27861
+
27862
+ function Entity() {
27863
+ };
27864
+ Entity.prototype.nodeType = ENTITY_NODE;
27865
+ _extends(Entity,Node);
27866
+
27867
+ function EntityReference() {
27868
+ };
27869
+ EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
27870
+ _extends(EntityReference,Node);
27871
+
27872
+ function DocumentFragment() {
27873
+ };
27874
+ DocumentFragment.prototype.nodeName = "#document-fragment";
27875
+ DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
27876
+ _extends(DocumentFragment,Node);
27877
+
27878
+
27879
+ function ProcessingInstruction() {
27880
+ }
27881
+ ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
27882
+ _extends(ProcessingInstruction,Node);
27883
+ function XMLSerializer(){}
27884
+ XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
27885
+ return nodeSerializeToString.call(node,isHtml,nodeFilter);
27886
+ }
27887
+ Node.prototype.toString = nodeSerializeToString;
27888
+ function nodeSerializeToString(isHtml,nodeFilter){
27889
+ var buf = [];
27890
+ var refNode = this.nodeType == 9 && this.documentElement || this;
27891
+ var prefix = refNode.prefix;
27892
+ var uri = refNode.namespaceURI;
27893
+
27894
+ if(uri && prefix == null){
27895
+ //console.log(prefix)
27896
+ var prefix = refNode.lookupPrefix(uri);
27897
+ if(prefix == null){
27898
+ //isHTML = true;
27899
+ var visibleNamespaces=[
27900
+ {namespace:uri,prefix:null}
27901
+ //{namespace:uri,prefix:''}
27902
+ ]
27903
+ }
27904
+ }
27905
+ serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
27906
+ //console.log('###',this.nodeType,uri,prefix,buf.join(''))
27907
+ return buf.join('');
27908
+ }
27909
+
27910
+ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
27911
+ var prefix = node.prefix || '';
27912
+ var uri = node.namespaceURI;
27913
+ // According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,
27914
+ // and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :
27915
+ // > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.
27916
+ // in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)
27917
+ // and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :
27918
+ // > [...] Furthermore, the attribute value [...] must not be an empty string.
27919
+ // so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document.
27920
+ if (!uri) {
27921
+ return false;
27922
+ }
27923
+ if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
27924
+ return false;
27925
+ }
27926
+
27927
+ var i = visibleNamespaces.length
27928
+ while (i--) {
27929
+ var ns = visibleNamespaces[i];
27930
+ // get namespace prefix
27931
+ if (ns.prefix === prefix) {
27932
+ return ns.namespace !== uri;
27933
+ }
27934
+ }
27935
+ return true;
27936
+ }
27937
+ /**
27938
+ * Well-formed constraint: No < in Attribute Values
27939
+ * > The replacement text of any entity referred to directly or indirectly
27940
+ * > in an attribute value must not contain a <.
27941
+ * @see https://www.w3.org/TR/xml11/#CleanAttrVals
27942
+ * @see https://www.w3.org/TR/xml11/#NT-AttValue
27943
+ *
27944
+ * Literal whitespace other than space that appear in attribute values
27945
+ * are serialized as their entity references, so they will be preserved.
27946
+ * (In contrast to whitespace literals in the input which are normalized to spaces)
27947
+ * @see https://www.w3.org/TR/xml11/#AVNormalize
27948
+ */
27949
+ function addSerializedAttribute(buf, qualifiedName, value) {
27950
+ buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
27951
+ }
27952
+
27953
+ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
27954
+ if (!visibleNamespaces) {
27955
+ visibleNamespaces = [];
27956
+ }
27957
+
27958
+ if(nodeFilter){
27959
+ node = nodeFilter(node);
27960
+ if(node){
27961
+ if(typeof node == 'string'){
27962
+ buf.push(node);
27963
+ return;
27964
+ }
27965
+ }else{
27966
+ return;
27967
+ }
27968
+ //buf.sort.apply(attrs, attributeSorter);
27969
+ }
27970
+
27971
+ switch(node.nodeType){
27972
+ case ELEMENT_NODE:
27973
+ var attrs = node.attributes;
27974
+ var len = attrs.length;
27975
+ var child = node.firstChild;
27976
+ var nodeName = node.tagName;
27977
+
27978
+ isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML
27979
+
27980
+ var prefixedNodeName = nodeName
27981
+ if (!isHTML && !node.prefix && node.namespaceURI) {
27982
+ var defaultNS
27983
+ // lookup current default ns from `xmlns` attribute
27984
+ for (var ai = 0; ai < attrs.length; ai++) {
27985
+ if (attrs.item(ai).name === 'xmlns') {
27986
+ defaultNS = attrs.item(ai).value
27987
+ break
27988
+ }
27989
+ }
27990
+ if (!defaultNS) {
27991
+ // lookup current default ns in visibleNamespaces
27992
+ for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
27993
+ var namespace = visibleNamespaces[nsi]
27994
+ if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
27995
+ defaultNS = namespace.namespace
27996
+ break
27997
+ }
27998
+ }
27999
+ }
28000
+ if (defaultNS !== node.namespaceURI) {
28001
+ for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
28002
+ var namespace = visibleNamespaces[nsi]
28003
+ if (namespace.namespace === node.namespaceURI) {
28004
+ if (namespace.prefix) {
28005
+ prefixedNodeName = namespace.prefix + ':' + nodeName
28006
+ }
28007
+ break
28008
+ }
28009
+ }
28010
+ }
28011
+ }
28012
+
28013
+ buf.push('<', prefixedNodeName);
28014
+
28015
+ for(var i=0;i<len;i++){
28016
+ // add namespaces for attributes
28017
+ var attr = attrs.item(i);
28018
+ if (attr.prefix == 'xmlns') {
28019
+ visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
28020
+ }else if(attr.nodeName == 'xmlns'){
28021
+ visibleNamespaces.push({ prefix: '', namespace: attr.value });
28022
+ }
28023
+ }
28024
+
28025
+ for(var i=0;i<len;i++){
28026
+ var attr = attrs.item(i);
28027
+ if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
28028
+ var prefix = attr.prefix||'';
28029
+ var uri = attr.namespaceURI;
28030
+ addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
28031
+ visibleNamespaces.push({ prefix: prefix, namespace:uri });
28032
+ }
28033
+ serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
28034
+ }
28035
+
28036
+ // add namespace for current node
28037
+ if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
28038
+ var prefix = node.prefix||'';
28039
+ var uri = node.namespaceURI;
28040
+ addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
28041
+ visibleNamespaces.push({ prefix: prefix, namespace:uri });
28042
+ }
28043
+
28044
+ if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
28045
+ buf.push('>');
28046
+ //if is cdata child node
28047
+ if(isHTML && /^script$/i.test(nodeName)){
28048
+ while(child){
28049
+ if(child.data){
28050
+ buf.push(child.data);
28051
+ }else{
28052
+ serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
28053
+ }
28054
+ child = child.nextSibling;
28055
+ }
28056
+ }else
28057
+ {
28058
+ while(child){
28059
+ serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
28060
+ child = child.nextSibling;
28061
+ }
28062
+ }
28063
+ buf.push('</',prefixedNodeName,'>');
28064
+ }else{
28065
+ buf.push('/>');
28066
+ }
28067
+ // remove added visible namespaces
28068
+ //visibleNamespaces.length = startVisibleNamespaces;
28069
+ return;
28070
+ case DOCUMENT_NODE:
28071
+ case DOCUMENT_FRAGMENT_NODE:
28072
+ var child = node.firstChild;
28073
+ while(child){
28074
+ serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
28075
+ child = child.nextSibling;
28076
+ }
28077
+ return;
28078
+ case ATTRIBUTE_NODE:
28079
+ return addSerializedAttribute(buf, node.name, node.value);
28080
+ case TEXT_NODE:
28081
+ /**
28082
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
28083
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
28084
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
28085
+ * `&amp;` and `&lt;` respectively.
28086
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
28087
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
28088
+ * when that string is not marking the end of a CDATA section.
28089
+ *
28090
+ * In the content of elements, character data is any string of characters
28091
+ * which does not contain the start-delimiter of any markup
28092
+ * and does not include the CDATA-section-close delimiter, `]]>`.
28093
+ *
28094
+ * @see https://www.w3.org/TR/xml/#NT-CharData
28095
+ */
28096
+ return buf.push(node.data
28097
+ .replace(/[<&]/g,_xmlEncoder)
28098
+ .replace(/]]>/g, ']]&gt;')
28099
+ );
28100
+ case CDATA_SECTION_NODE:
28101
+ return buf.push( '<![CDATA[',node.data,']]>');
28102
+ case COMMENT_NODE:
28103
+ return buf.push( "<!--",node.data,"-->");
28104
+ case DOCUMENT_TYPE_NODE:
28105
+ var pubid = node.publicId;
28106
+ var sysid = node.systemId;
28107
+ buf.push('<!DOCTYPE ',node.name);
28108
+ if(pubid){
28109
+ buf.push(' PUBLIC ', pubid);
28110
+ if (sysid && sysid!='.') {
28111
+ buf.push(' ', sysid);
28112
+ }
28113
+ buf.push('>');
28114
+ }else if(sysid && sysid!='.'){
28115
+ buf.push(' SYSTEM ', sysid, '>');
28116
+ }else{
28117
+ var sub = node.internalSubset;
28118
+ if(sub){
28119
+ buf.push(" [",sub,"]");
28120
+ }
28121
+ buf.push(">");
28122
+ }
28123
+ return;
28124
+ case PROCESSING_INSTRUCTION_NODE:
28125
+ return buf.push( "<?",node.target," ",node.data,"?>");
28126
+ case ENTITY_REFERENCE_NODE:
28127
+ return buf.push( '&',node.nodeName,';');
28128
+ //case ENTITY_NODE:
28129
+ //case NOTATION_NODE:
28130
+ default:
28131
+ buf.push('??',node.nodeName);
28132
+ }
28133
+ }
28134
+ function importNode(doc,node,deep){
28135
+ var node2;
28136
+ switch (node.nodeType) {
28137
+ case ELEMENT_NODE:
28138
+ node2 = node.cloneNode(false);
28139
+ node2.ownerDocument = doc;
28140
+ //var attrs = node2.attributes;
28141
+ //var len = attrs.length;
28142
+ //for(var i=0;i<len;i++){
28143
+ //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
28144
+ //}
28145
+ case DOCUMENT_FRAGMENT_NODE:
28146
+ break;
28147
+ case ATTRIBUTE_NODE:
28148
+ deep = true;
28149
+ break;
28150
+ //case ENTITY_REFERENCE_NODE:
28151
+ //case PROCESSING_INSTRUCTION_NODE:
28152
+ ////case TEXT_NODE:
28153
+ //case CDATA_SECTION_NODE:
28154
+ //case COMMENT_NODE:
28155
+ // deep = false;
28156
+ // break;
28157
+ //case DOCUMENT_NODE:
28158
+ //case DOCUMENT_TYPE_NODE:
28159
+ //cannot be imported.
28160
+ //case ENTITY_NODE:
28161
+ //case NOTATION_NODE:
28162
+ //can not hit in level3
28163
+ //default:throw e;
28164
+ }
28165
+ if(!node2){
28166
+ node2 = node.cloneNode(false);//false
28167
+ }
28168
+ node2.ownerDocument = doc;
28169
+ node2.parentNode = null;
28170
+ if(deep){
28171
+ var child = node.firstChild;
28172
+ while(child){
28173
+ node2.appendChild(importNode(doc,child,deep));
28174
+ child = child.nextSibling;
28175
+ }
28176
+ }
28177
+ return node2;
28178
+ }
28179
+ //
28180
+ //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
28181
+ // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
28182
+ function cloneNode(doc,node,deep){
28183
+ var node2 = new node.constructor();
28184
+ for(var n in node){
28185
+ var v = node[n];
28186
+ if(typeof v != 'object' ){
28187
+ if(v != node2[n]){
28188
+ node2[n] = v;
28189
+ }
28190
+ }
28191
+ }
28192
+ if(node.childNodes){
28193
+ node2.childNodes = new NodeList();
28194
+ }
28195
+ node2.ownerDocument = doc;
28196
+ switch (node2.nodeType) {
28197
+ case ELEMENT_NODE:
28198
+ var attrs = node.attributes;
28199
+ var attrs2 = node2.attributes = new NamedNodeMap();
28200
+ var len = attrs.length
28201
+ attrs2._ownerElement = node2;
28202
+ for(var i=0;i<len;i++){
28203
+ node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
28204
+ }
28205
+ break;;
28206
+ case ATTRIBUTE_NODE:
28207
+ deep = true;
28208
+ }
28209
+ if(deep){
28210
+ var child = node.firstChild;
28211
+ while(child){
28212
+ node2.appendChild(cloneNode(doc,child,deep));
28213
+ child = child.nextSibling;
28214
+ }
28215
+ }
28216
+ return node2;
28217
+ }
28218
+
28219
+ function __set__(object,key,value){
28220
+ object[key] = value
28221
+ }
28222
+ //do dynamic
28223
+ try{
28224
+ if(Object.defineProperty){
28225
+ Object.defineProperty(LiveNodeList.prototype,'length',{
28226
+ get:function(){
28227
+ _updateLiveList(this);
28228
+ return this.$$length;
28229
+ }
28230
+ });
28231
+
28232
+ Object.defineProperty(Node.prototype,'textContent',{
28233
+ get:function(){
28234
+ return getTextContent(this);
28235
+ },
28236
+
28237
+ set:function(data){
28238
+ switch(this.nodeType){
28239
+ case ELEMENT_NODE:
28240
+ case DOCUMENT_FRAGMENT_NODE:
28241
+ while(this.firstChild){
28242
+ this.removeChild(this.firstChild);
28243
+ }
28244
+ if(data || String(data)){
28245
+ this.appendChild(this.ownerDocument.createTextNode(data));
28246
+ }
28247
+ break;
28248
+
28249
+ default:
28250
+ this.data = data;
28251
+ this.value = data;
28252
+ this.nodeValue = data;
28253
+ }
28254
+ }
28255
+ })
28256
+
28257
+ function getTextContent(node){
28258
+ switch(node.nodeType){
28259
+ case ELEMENT_NODE:
28260
+ case DOCUMENT_FRAGMENT_NODE:
28261
+ var buf = [];
28262
+ node = node.firstChild;
28263
+ while(node){
28264
+ if(node.nodeType!==7 && node.nodeType !==8){
28265
+ buf.push(getTextContent(node));
28266
+ }
28267
+ node = node.nextSibling;
28268
+ }
28269
+ return buf.join('');
28270
+ default:
28271
+ return node.nodeValue;
28272
+ }
28273
+ }
28274
+
28275
+ __set__ = function(object,key,value){
28276
+ //console.log(value)
28277
+ object['$$'+key] = value
28278
+ }
28279
+ }
28280
+ }catch(e){//ie8
28281
+ }
28282
+
28283
+ //if(typeof require == 'function'){
28284
+ exports.DocumentType = DocumentType;
28285
+ exports.DOMException = DOMException;
28286
+ exports.DOMImplementation = DOMImplementation;
28287
+ exports.Element = Element;
28288
+ exports.Node = Node;
28289
+ exports.NodeList = NodeList;
28290
+ exports.XMLSerializer = XMLSerializer;
28291
+ //}
28292
+
28293
+
28294
+ /***/ }),
28295
+
28296
+ /***/ "./node_modules/@xmldom/xmldom/lib/entities.js":
28297
+ /*!*****************************************************!*\
28298
+ !*** ./node_modules/@xmldom/xmldom/lib/entities.js ***!
28299
+ \*****************************************************/
28300
+ /*! no static exports found */
28301
+ /***/ (function(module, exports, __webpack_require__) {
28302
+
28303
+ var freeze = __webpack_require__(/*! ./conventions */ "./node_modules/@xmldom/xmldom/lib/conventions.js").freeze;
28304
+
28305
+ /**
28306
+ * The entities that are predefined in every XML document.
28307
+ *
28308
+ * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
28309
+ * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
28310
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
28311
+ */
28312
+ exports.XML_ENTITIES = freeze({amp:'&', apos:"'", gt:'>', lt:'<', quot:'"'})
28313
+
28314
+ /**
28315
+ * A map of currently 241 entities that are detected in an HTML document.
28316
+ * They contain all entries from `XML_ENTITIES`.
28317
+ *
28318
+ * @see XML_ENTITIES
28319
+ * @see DOMParser.parseFromString
28320
+ * @see DOMImplementation.prototype.createHTMLDocument
28321
+ * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
28322
+ * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
28323
+ * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
28324
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
28325
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
28326
+ */
28327
+ exports.HTML_ENTITIES = freeze({
28328
+ lt: '<',
28329
+ gt: '>',
28330
+ amp: '&',
28331
+ quot: '"',
28332
+ apos: "'",
28333
+ Agrave: "À",
28334
+ Aacute: "Á",
28335
+ Acirc: "Â",
28336
+ Atilde: "Ã",
28337
+ Auml: "Ä",
28338
+ Aring: "Å",
28339
+ AElig: "Æ",
28340
+ Ccedil: "Ç",
28341
+ Egrave: "È",
28342
+ Eacute: "É",
28343
+ Ecirc: "Ê",
28344
+ Euml: "Ë",
28345
+ Igrave: "Ì",
28346
+ Iacute: "Í",
28347
+ Icirc: "Î",
28348
+ Iuml: "Ï",
28349
+ ETH: "Ð",
28350
+ Ntilde: "Ñ",
28351
+ Ograve: "Ò",
28352
+ Oacute: "Ó",
28353
+ Ocirc: "Ô",
28354
+ Otilde: "Õ",
28355
+ Ouml: "Ö",
28356
+ Oslash: "Ø",
28357
+ Ugrave: "Ù",
28358
+ Uacute: "Ú",
28359
+ Ucirc: "Û",
28360
+ Uuml: "Ü",
28361
+ Yacute: "Ý",
28362
+ THORN: "Þ",
28363
+ szlig: "ß",
28364
+ agrave: "à",
28365
+ aacute: "á",
28366
+ acirc: "â",
28367
+ atilde: "ã",
28368
+ auml: "ä",
28369
+ aring: "å",
28370
+ aelig: "æ",
28371
+ ccedil: "ç",
28372
+ egrave: "è",
28373
+ eacute: "é",
28374
+ ecirc: "ê",
28375
+ euml: "ë",
28376
+ igrave: "ì",
28377
+ iacute: "í",
28378
+ icirc: "î",
28379
+ iuml: "ï",
28380
+ eth: "ð",
28381
+ ntilde: "ñ",
28382
+ ograve: "ò",
28383
+ oacute: "ó",
28384
+ ocirc: "ô",
28385
+ otilde: "õ",
28386
+ ouml: "ö",
28387
+ oslash: "ø",
28388
+ ugrave: "ù",
28389
+ uacute: "ú",
28390
+ ucirc: "û",
28391
+ uuml: "ü",
28392
+ yacute: "ý",
28393
+ thorn: "þ",
28394
+ yuml: "ÿ",
28395
+ nbsp: "\u00a0",
28396
+ iexcl: "¡",
28397
+ cent: "¢",
28398
+ pound: "£",
28399
+ curren: "¤",
28400
+ yen: "¥",
28401
+ brvbar: "¦",
28402
+ sect: "§",
28403
+ uml: "¨",
28404
+ copy: "©",
28405
+ ordf: "ª",
28406
+ laquo: "«",
28407
+ not: "¬",
28408
+ shy: "­­",
28409
+ reg: "®",
28410
+ macr: "¯",
28411
+ deg: "°",
28412
+ plusmn: "±",
28413
+ sup2: "²",
28414
+ sup3: "³",
28415
+ acute: "´",
28416
+ micro: "µ",
28417
+ para: "¶",
28418
+ middot: "·",
28419
+ cedil: "¸",
28420
+ sup1: "¹",
28421
+ ordm: "º",
28422
+ raquo: "»",
28423
+ frac14: "¼",
28424
+ frac12: "½",
28425
+ frac34: "¾",
28426
+ iquest: "¿",
28427
+ times: "×",
28428
+ divide: "÷",
28429
+ forall: "∀",
28430
+ part: "∂",
28431
+ exist: "∃",
28432
+ empty: "∅",
28433
+ nabla: "∇",
28434
+ isin: "∈",
28435
+ notin: "∉",
28436
+ ni: "∋",
28437
+ prod: "∏",
28438
+ sum: "∑",
28439
+ minus: "−",
28440
+ lowast: "∗",
28441
+ radic: "√",
28442
+ prop: "∝",
28443
+ infin: "∞",
28444
+ ang: "∠",
28445
+ and: "∧",
28446
+ or: "∨",
28447
+ cap: "∩",
28448
+ cup: "∪",
28449
+ 'int': "∫",
28450
+ there4: "∴",
28451
+ sim: "∼",
28452
+ cong: "≅",
28453
+ asymp: "≈",
28454
+ ne: "≠",
28455
+ equiv: "≡",
28456
+ le: "≤",
28457
+ ge: "≥",
28458
+ sub: "⊂",
28459
+ sup: "⊃",
28460
+ nsub: "⊄",
28461
+ sube: "⊆",
28462
+ supe: "⊇",
28463
+ oplus: "⊕",
28464
+ otimes: "⊗",
28465
+ perp: "⊥",
28466
+ sdot: "⋅",
28467
+ Alpha: "Α",
28468
+ Beta: "Β",
28469
+ Gamma: "Γ",
28470
+ Delta: "Δ",
28471
+ Epsilon: "Ε",
28472
+ Zeta: "Ζ",
28473
+ Eta: "Η",
28474
+ Theta: "Θ",
28475
+ Iota: "Ι",
28476
+ Kappa: "Κ",
28477
+ Lambda: "Λ",
28478
+ Mu: "Μ",
28479
+ Nu: "Ν",
28480
+ Xi: "Ξ",
28481
+ Omicron: "Ο",
28482
+ Pi: "Π",
28483
+ Rho: "Ρ",
28484
+ Sigma: "Σ",
28485
+ Tau: "Τ",
28486
+ Upsilon: "Υ",
28487
+ Phi: "Φ",
28488
+ Chi: "Χ",
28489
+ Psi: "Ψ",
28490
+ Omega: "Ω",
28491
+ alpha: "α",
28492
+ beta: "β",
28493
+ gamma: "γ",
28494
+ delta: "δ",
28495
+ epsilon: "ε",
28496
+ zeta: "ζ",
28497
+ eta: "η",
28498
+ theta: "θ",
28499
+ iota: "ι",
28500
+ kappa: "κ",
28501
+ lambda: "λ",
28502
+ mu: "μ",
28503
+ nu: "ν",
28504
+ xi: "ξ",
28505
+ omicron: "ο",
28506
+ pi: "π",
28507
+ rho: "ρ",
28508
+ sigmaf: "ς",
28509
+ sigma: "σ",
28510
+ tau: "τ",
28511
+ upsilon: "υ",
28512
+ phi: "φ",
28513
+ chi: "χ",
28514
+ psi: "ψ",
28515
+ omega: "ω",
28516
+ thetasym: "ϑ",
28517
+ upsih: "ϒ",
28518
+ piv: "ϖ",
28519
+ OElig: "Œ",
28520
+ oelig: "œ",
28521
+ Scaron: "Š",
28522
+ scaron: "š",
28523
+ Yuml: "Ÿ",
28524
+ fnof: "ƒ",
28525
+ circ: "ˆ",
28526
+ tilde: "˜",
28527
+ ensp: " ",
28528
+ emsp: " ",
28529
+ thinsp: " ",
28530
+ zwnj: "‌",
28531
+ zwj: "‍",
28532
+ lrm: "‎",
28533
+ rlm: "‏",
28534
+ ndash: "–",
28535
+ mdash: "—",
28536
+ lsquo: "‘",
28537
+ rsquo: "’",
28538
+ sbquo: "‚",
28539
+ ldquo: "“",
28540
+ rdquo: "”",
28541
+ bdquo: "„",
28542
+ dagger: "†",
28543
+ Dagger: "‡",
28544
+ bull: "•",
28545
+ hellip: "…",
28546
+ permil: "‰",
28547
+ prime: "′",
28548
+ Prime: "″",
28549
+ lsaquo: "‹",
28550
+ rsaquo: "›",
28551
+ oline: "‾",
28552
+ euro: "€",
28553
+ trade: "™",
28554
+ larr: "←",
28555
+ uarr: "↑",
28556
+ rarr: "→",
28557
+ darr: "↓",
28558
+ harr: "↔",
28559
+ crarr: "↵",
28560
+ lceil: "⌈",
28561
+ rceil: "⌉",
28562
+ lfloor: "⌊",
28563
+ rfloor: "⌋",
28564
+ loz: "◊",
28565
+ spades: "♠",
28566
+ clubs: "♣",
28567
+ hearts: "♥",
28568
+ diams: "♦"
28569
+ });
28570
+
28571
+ /**
28572
+ * @deprecated use `HTML_ENTITIES` instead
28573
+ * @see HTML_ENTITIES
28574
+ */
28575
+ exports.entityMap = exports.HTML_ENTITIES
28576
+
28577
+
28578
+ /***/ }),
28579
+
28580
+ /***/ "./node_modules/@xmldom/xmldom/lib/index.js":
28581
+ /*!**************************************************!*\
28582
+ !*** ./node_modules/@xmldom/xmldom/lib/index.js ***!
28583
+ \**************************************************/
28584
+ /*! no static exports found */
28585
+ /***/ (function(module, exports, __webpack_require__) {
28586
+
28587
+ var dom = __webpack_require__(/*! ./dom */ "./node_modules/@xmldom/xmldom/lib/dom.js")
28588
+ exports.DOMImplementation = dom.DOMImplementation
28589
+ exports.XMLSerializer = dom.XMLSerializer
28590
+ exports.DOMParser = __webpack_require__(/*! ./dom-parser */ "./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser
28591
+
28592
+
28593
+ /***/ }),
28594
+
28595
+ /***/ "./node_modules/@xmldom/xmldom/lib/sax.js":
28596
+ /*!************************************************!*\
28597
+ !*** ./node_modules/@xmldom/xmldom/lib/sax.js ***!
28598
+ \************************************************/
28599
+ /*! no static exports found */
28600
+ /***/ (function(module, exports, __webpack_require__) {
28601
+
28602
+ var NAMESPACE = __webpack_require__(/*! ./conventions */ "./node_modules/@xmldom/xmldom/lib/conventions.js").NAMESPACE;
28603
+
28604
+ //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
28605
+ //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
28606
+ //[5] Name ::= NameStartChar (NameChar)*
28607
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
28608
+ var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
28609
+ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
28610
+ //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
28611
+ //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
28612
+
28613
+ //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
28614
+ //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
28615
+ var S_TAG = 0;//tag name offerring
28616
+ var S_ATTR = 1;//attr name offerring
28617
+ var S_ATTR_SPACE=2;//attr name end and space offer
28618
+ var S_EQ = 3;//=space?
28619
+ var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
28620
+ var S_ATTR_END = 5;//attr value end and no space(quot end)
28621
+ var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)
28622
+ var S_TAG_CLOSE = 7;//closed el<el />
28623
+
28624
+ /**
28625
+ * Creates an error that will not be caught by XMLReader aka the SAX parser.
28626
+ *
28627
+ * @param {string} message
28628
+ * @param {any?} locator Optional, can provide details about the location in the source
28629
+ * @constructor
28630
+ */
28631
+ function ParseError(message, locator) {
28632
+ this.message = message
28633
+ this.locator = locator
28634
+ if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
28635
+ }
28636
+ ParseError.prototype = new Error();
28637
+ ParseError.prototype.name = ParseError.name
28638
+
28639
+ function XMLReader(){
28640
+
28641
+ }
28642
+
28643
+ XMLReader.prototype = {
28644
+ parse:function(source,defaultNSMap,entityMap){
28645
+ var domBuilder = this.domBuilder;
28646
+ domBuilder.startDocument();
28647
+ _copy(defaultNSMap ,defaultNSMap = {})
28648
+ parse(source,defaultNSMap,entityMap,
28649
+ domBuilder,this.errorHandler);
28650
+ domBuilder.endDocument();
28651
+ }
28652
+ }
28653
+ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
28654
+ function fixedFromCharCode(code) {
28655
+ // String.prototype.fromCharCode does not supports
28656
+ // > 2 bytes unicode chars directly
28657
+ if (code > 0xffff) {
28658
+ code -= 0x10000;
28659
+ var surrogate1 = 0xd800 + (code >> 10)
28660
+ , surrogate2 = 0xdc00 + (code & 0x3ff);
28661
+
28662
+ return String.fromCharCode(surrogate1, surrogate2);
28663
+ } else {
28664
+ return String.fromCharCode(code);
28665
+ }
28666
+ }
28667
+ function entityReplacer(a){
28668
+ var k = a.slice(1,-1);
28669
+ if(k in entityMap){
28670
+ return entityMap[k];
28671
+ }else if(k.charAt(0) === '#'){
28672
+ return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
28673
+ }else{
28674
+ errorHandler.error('entity not found:'+a);
28675
+ return a;
28676
+ }
28677
+ }
28678
+ function appendText(end){//has some bugs
28679
+ if(end>start){
28680
+ var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
28681
+ locator&&position(start);
28682
+ domBuilder.characters(xt,0,end-start);
28683
+ start = end
28684
+ }
28685
+ }
28686
+ function position(p,m){
28687
+ while(p>=lineEnd && (m = linePattern.exec(source))){
28688
+ lineStart = m.index;
28689
+ lineEnd = lineStart + m[0].length;
28690
+ locator.lineNumber++;
28691
+ //console.log('line++:',locator,startPos,endPos)
28692
+ }
28693
+ locator.columnNumber = p-lineStart+1;
28694
+ }
28695
+ var lineStart = 0;
28696
+ var lineEnd = 0;
28697
+ var linePattern = /.*(?:\r\n?|\n)|.*$/g
28698
+ var locator = domBuilder.locator;
28699
+
28700
+ var parseStack = [{currentNSMap:defaultNSMapCopy}]
28701
+ var closeMap = {};
28702
+ var start = 0;
28703
+ while(true){
28704
+ try{
28705
+ var tagStart = source.indexOf('<',start);
28706
+ if(tagStart<0){
28707
+ if(!source.substr(start).match(/^\s*$/)){
28708
+ var doc = domBuilder.doc;
28709
+ var text = doc.createTextNode(source.substr(start));
28710
+ doc.appendChild(text);
28711
+ domBuilder.currentElement = text;
28712
+ }
28713
+ return;
28714
+ }
28715
+ if(tagStart>start){
28716
+ appendText(tagStart);
28717
+ }
28718
+ switch(source.charAt(tagStart+1)){
28719
+ case '/':
28720
+ var end = source.indexOf('>',tagStart+3);
28721
+ var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
28722
+ var config = parseStack.pop();
28723
+ if(end<0){
28724
+
28725
+ tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
28726
+ errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
28727
+ end = tagStart+1+tagName.length;
28728
+ }else if(tagName.match(/\s</)){
28729
+ tagName = tagName.replace(/[\s<].*/,'');
28730
+ errorHandler.error("end tag name: "+tagName+' maybe not complete');
28731
+ end = tagStart+1+tagName.length;
28732
+ }
28733
+ var localNSMap = config.localNSMap;
28734
+ var endMatch = config.tagName == tagName;
28735
+ var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()
28736
+ if(endIgnoreCaseMach){
28737
+ domBuilder.endElement(config.uri,config.localName,tagName);
28738
+ if(localNSMap){
28739
+ for(var prefix in localNSMap){
28740
+ domBuilder.endPrefixMapping(prefix) ;
28741
+ }
28742
+ }
28743
+ if(!endMatch){
28744
+ errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case
28745
+ }
28746
+ }else{
28747
+ parseStack.push(config)
28748
+ }
28749
+
28750
+ end++;
28751
+ break;
28752
+ // end elment
28753
+ case '?':// <?...?>
28754
+ locator&&position(tagStart);
28755
+ end = parseInstruction(source,tagStart,domBuilder);
28756
+ break;
28757
+ case '!':// <!doctype,<![CDATA,<!--
28758
+ locator&&position(tagStart);
28759
+ end = parseDCC(source,tagStart,domBuilder,errorHandler);
28760
+ break;
28761
+ default:
28762
+ locator&&position(tagStart);
28763
+ var el = new ElementAttributes();
28764
+ var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
28765
+ //elStartEnd
28766
+ var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
28767
+ var len = el.length;
28768
+
28769
+
28770
+ if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
28771
+ el.closed = true;
28772
+ if(!entityMap.nbsp){
28773
+ errorHandler.warning('unclosed xml attribute');
28774
+ }
28775
+ }
28776
+ if(locator && len){
28777
+ var locator2 = copyLocator(locator,{});
28778
+ //try{//attribute position fixed
28779
+ for(var i = 0;i<len;i++){
28780
+ var a = el[i];
28781
+ position(a.offset);
28782
+ a.locator = copyLocator(locator,{});
28783
+ }
28784
+ domBuilder.locator = locator2
28785
+ if(appendElement(el,domBuilder,currentNSMap)){
28786
+ parseStack.push(el)
28787
+ }
28788
+ domBuilder.locator = locator;
28789
+ }else{
28790
+ if(appendElement(el,domBuilder,currentNSMap)){
28791
+ parseStack.push(el)
28792
+ }
28793
+ }
28794
+
28795
+ if (NAMESPACE.isHTML(el.uri) && !el.closed) {
28796
+ end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
28797
+ } else {
28798
+ end++;
28799
+ }
28800
+ }
28801
+ }catch(e){
28802
+ if (e instanceof ParseError) {
28803
+ throw e;
28804
+ }
28805
+ errorHandler.error('element parse error: '+e)
28806
+ end = -1;
28807
+ }
28808
+ if(end>start){
28809
+ start = end;
28810
+ }else{
28811
+ //TODO: 这里有可能sax回退,有位置错误风险
28812
+ appendText(Math.max(tagStart,start)+1);
28813
+ }
28814
+ }
28815
+ }
28816
+ function copyLocator(f,t){
28817
+ t.lineNumber = f.lineNumber;
28818
+ t.columnNumber = f.columnNumber;
28819
+ return t;
28820
+ }
28821
+
28822
+ /**
28823
+ * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
28824
+ * @return end of the elementStartPart(end of elementEndPart for selfClosed el)
28825
+ */
28826
+ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
28827
+
28828
+ /**
28829
+ * @param {string} qname
28830
+ * @param {string} value
28831
+ * @param {number} startIndex
28832
+ */
28833
+ function addAttribute(qname, value, startIndex) {
28834
+ if (el.attributeNames.hasOwnProperty(qname)) {
28835
+ errorHandler.fatalError('Attribute ' + qname + ' redefined')
28836
+ }
28837
+ el.addValue(
28838
+ qname,
28839
+ // @see https://www.w3.org/TR/xml/#AVNormalize
28840
+ // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
28841
+ // - recursive replacement of (DTD) entity references
28842
+ // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
28843
+ value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityReplacer),
28844
+ startIndex
28845
+ )
28846
+ }
28847
+ var attrName;
28848
+ var value;
28849
+ var p = ++start;
28850
+ var s = S_TAG;//status
28851
+ while(true){
28852
+ var c = source.charAt(p);
28853
+ switch(c){
28854
+ case '=':
28855
+ if(s === S_ATTR){//attrName
28856
+ attrName = source.slice(start,p);
28857
+ s = S_EQ;
28858
+ }else if(s === S_ATTR_SPACE){
28859
+ s = S_EQ;
28860
+ }else{
28861
+ //fatalError: equal must after attrName or space after attrName
28862
+ throw new Error('attribute equal must after attrName'); // No known test case
28863
+ }
28864
+ break;
28865
+ case '\'':
28866
+ case '"':
28867
+ if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE
28868
+ ){//equal
28869
+ if(s === S_ATTR){
28870
+ errorHandler.warning('attribute value must after "="')
28871
+ attrName = source.slice(start,p)
28872
+ }
28873
+ start = p+1;
28874
+ p = source.indexOf(c,start)
28875
+ if(p>0){
28876
+ value = source.slice(start, p);
28877
+ addAttribute(attrName, value, start-1);
28878
+ s = S_ATTR_END;
28879
+ }else{
28880
+ //fatalError: no end quot match
28881
+ throw new Error('attribute value no end \''+c+'\' match');
28882
+ }
28883
+ }else if(s == S_ATTR_NOQUOT_VALUE){
28884
+ value = source.slice(start, p);
28885
+ addAttribute(attrName, value, start);
28886
+ errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
28887
+ start = p+1;
28888
+ s = S_ATTR_END
28889
+ }else{
28890
+ //fatalError: no equal before
28891
+ throw new Error('attribute value must after "="'); // No known test case
28892
+ }
28893
+ break;
28894
+ case '/':
28895
+ switch(s){
28896
+ case S_TAG:
28897
+ el.setTagName(source.slice(start,p));
28898
+ case S_ATTR_END:
28899
+ case S_TAG_SPACE:
28900
+ case S_TAG_CLOSE:
28901
+ s =S_TAG_CLOSE;
28902
+ el.closed = true;
28903
+ case S_ATTR_NOQUOT_VALUE:
28904
+ case S_ATTR:
28905
+ case S_ATTR_SPACE:
28906
+ break;
28907
+ //case S_EQ:
28908
+ default:
28909
+ throw new Error("attribute invalid close char('/')") // No known test case
28910
+ }
28911
+ break;
28912
+ case ''://end document
28913
+ errorHandler.error('unexpected end of input');
28914
+ if(s == S_TAG){
28915
+ el.setTagName(source.slice(start,p));
28916
+ }
28917
+ return p;
28918
+ case '>':
28919
+ switch(s){
28920
+ case S_TAG:
28921
+ el.setTagName(source.slice(start,p));
28922
+ case S_ATTR_END:
28923
+ case S_TAG_SPACE:
28924
+ case S_TAG_CLOSE:
28925
+ break;//normal
28926
+ case S_ATTR_NOQUOT_VALUE://Compatible state
28927
+ case S_ATTR:
28928
+ value = source.slice(start,p);
28929
+ if(value.slice(-1) === '/'){
28930
+ el.closed = true;
28931
+ value = value.slice(0,-1)
28932
+ }
28933
+ case S_ATTR_SPACE:
28934
+ if(s === S_ATTR_SPACE){
28935
+ value = attrName;
28936
+ }
28937
+ if(s == S_ATTR_NOQUOT_VALUE){
28938
+ errorHandler.warning('attribute "'+value+'" missed quot(")!');
28939
+ addAttribute(attrName, value, start)
28940
+ }else{
28941
+ if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
28942
+ errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
28943
+ }
28944
+ addAttribute(value, value, start)
28945
+ }
28946
+ break;
28947
+ case S_EQ:
28948
+ throw new Error('attribute value missed!!');
28949
+ }
28950
+ // console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
28951
+ return p;
28952
+ /*xml space '\x20' | #x9 | #xD | #xA; */
28953
+ case '\u0080':
28954
+ c = ' ';
28955
+ default:
28956
+ if(c<= ' '){//space
28957
+ switch(s){
28958
+ case S_TAG:
28959
+ el.setTagName(source.slice(start,p));//tagName
28960
+ s = S_TAG_SPACE;
28961
+ break;
28962
+ case S_ATTR:
28963
+ attrName = source.slice(start,p)
28964
+ s = S_ATTR_SPACE;
28965
+ break;
28966
+ case S_ATTR_NOQUOT_VALUE:
28967
+ var value = source.slice(start, p);
28968
+ errorHandler.warning('attribute "'+value+'" missed quot(")!!');
28969
+ addAttribute(attrName, value, start)
28970
+ case S_ATTR_END:
28971
+ s = S_TAG_SPACE;
28972
+ break;
28973
+ //case S_TAG_SPACE:
28974
+ //case S_EQ:
28975
+ //case S_ATTR_SPACE:
28976
+ // void();break;
28977
+ //case S_TAG_CLOSE:
28978
+ //ignore warning
28979
+ }
28980
+ }else{//not space
28981
+ //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
28982
+ //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
28983
+ switch(s){
28984
+ //case S_TAG:void();break;
28985
+ //case S_ATTR:void();break;
28986
+ //case S_ATTR_NOQUOT_VALUE:void();break;
28987
+ case S_ATTR_SPACE:
28988
+ var tagName = el.tagName;
28989
+ if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
28990
+ errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
28991
+ }
28992
+ addAttribute(attrName, attrName, start);
28993
+ start = p;
28994
+ s = S_ATTR;
28995
+ break;
28996
+ case S_ATTR_END:
28997
+ errorHandler.warning('attribute space is required"'+attrName+'"!!')
28998
+ case S_TAG_SPACE:
28999
+ s = S_ATTR;
29000
+ start = p;
29001
+ break;
29002
+ case S_EQ:
29003
+ s = S_ATTR_NOQUOT_VALUE;
29004
+ start = p;
29005
+ break;
29006
+ case S_TAG_CLOSE:
29007
+ throw new Error("elements closed character '/' and '>' must be connected to");
29008
+ }
29009
+ }
29010
+ }//end outer switch
29011
+ //console.log('p++',p)
29012
+ p++;
29013
+ }
29014
+ }
29015
+ /**
29016
+ * @return true if has new namespace define
29017
+ */
29018
+ function appendElement(el,domBuilder,currentNSMap){
29019
+ var tagName = el.tagName;
29020
+ var localNSMap = null;
29021
+ //var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
29022
+ var i = el.length;
29023
+ while(i--){
29024
+ var a = el[i];
29025
+ var qName = a.qName;
29026
+ var value = a.value;
29027
+ var nsp = qName.indexOf(':');
29028
+ if(nsp>0){
29029
+ var prefix = a.prefix = qName.slice(0,nsp);
29030
+ var localName = qName.slice(nsp+1);
29031
+ var nsPrefix = prefix === 'xmlns' && localName
29032
+ }else{
29033
+ localName = qName;
29034
+ prefix = null
29035
+ nsPrefix = qName === 'xmlns' && ''
29036
+ }
29037
+ //can not set prefix,because prefix !== ''
29038
+ a.localName = localName ;
29039
+ //prefix == null for no ns prefix attribute
29040
+ if(nsPrefix !== false){//hack!!
29041
+ if(localNSMap == null){
29042
+ localNSMap = {}
29043
+ //console.log(currentNSMap,0)
29044
+ _copy(currentNSMap,currentNSMap={})
29045
+ //console.log(currentNSMap,1)
29046
+ }
29047
+ currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
29048
+ a.uri = NAMESPACE.XMLNS
29049
+ domBuilder.startPrefixMapping(nsPrefix, value)
29050
+ }
29051
+ }
29052
+ var i = el.length;
29053
+ while(i--){
29054
+ a = el[i];
29055
+ var prefix = a.prefix;
29056
+ if(prefix){//no prefix attribute has no namespace
29057
+ if(prefix === 'xml'){
29058
+ a.uri = NAMESPACE.XML;
29059
+ }if(prefix !== 'xmlns'){
29060
+ a.uri = currentNSMap[prefix || '']
29061
+
29062
+ //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
29063
+ }
29064
+ }
29065
+ }
29066
+ var nsp = tagName.indexOf(':');
29067
+ if(nsp>0){
29068
+ prefix = el.prefix = tagName.slice(0,nsp);
29069
+ localName = el.localName = tagName.slice(nsp+1);
29070
+ }else{
29071
+ prefix = null;//important!!
29072
+ localName = el.localName = tagName;
29073
+ }
29074
+ //no prefix element has default namespace
29075
+ var ns = el.uri = currentNSMap[prefix || ''];
29076
+ domBuilder.startElement(ns,localName,tagName,el);
29077
+ //endPrefixMapping and startPrefixMapping have not any help for dom builder
29078
+ //localNSMap = null
29079
+ if(el.closed){
29080
+ domBuilder.endElement(ns,localName,tagName);
29081
+ if(localNSMap){
29082
+ for(prefix in localNSMap){
29083
+ domBuilder.endPrefixMapping(prefix)
29084
+ }
29085
+ }
29086
+ }else{
29087
+ el.currentNSMap = currentNSMap;
29088
+ el.localNSMap = localNSMap;
29089
+ //parseStack.push(el);
29090
+ return true;
29091
+ }
29092
+ }
29093
+ function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
29094
+ if(/^(?:script|textarea)$/i.test(tagName)){
29095
+ var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
29096
+ var text = source.substring(elStartEnd+1,elEndStart);
29097
+ if(/[&<]/.test(text)){
29098
+ if(/^script$/i.test(tagName)){
29099
+ //if(!/\]\]>/.test(text)){
29100
+ //lexHandler.startCDATA();
29101
+ domBuilder.characters(text,0,text.length);
29102
+ //lexHandler.endCDATA();
29103
+ return elEndStart;
29104
+ //}
29105
+ }//}else{//text area
29106
+ text = text.replace(/&#?\w+;/g,entityReplacer);
29107
+ domBuilder.characters(text,0,text.length);
29108
+ return elEndStart;
29109
+ //}
29110
+
29111
+ }
29112
+ }
29113
+ return elStartEnd+1;
29114
+ }
29115
+ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
29116
+ //if(tagName in closeMap){
29117
+ var pos = closeMap[tagName];
29118
+ if(pos == null){
29119
+ //console.log(tagName)
29120
+ pos = source.lastIndexOf('</'+tagName+'>')
29121
+ if(pos<elStartEnd){//忘记闭合
29122
+ pos = source.lastIndexOf('</'+tagName)
29123
+ }
29124
+ closeMap[tagName] =pos
29125
+ }
29126
+ return pos<elStartEnd;
29127
+ //}
29128
+ }
29129
+ function _copy(source,target){
29130
+ for(var n in source){target[n] = source[n]}
29131
+ }
29132
+ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
29133
+ var next= source.charAt(start+2)
29134
+ switch(next){
29135
+ case '-':
29136
+ if(source.charAt(start + 3) === '-'){
29137
+ var end = source.indexOf('-->',start+4);
29138
+ //append comment source.substring(4,end)//<!--
29139
+ if(end>start){
29140
+ domBuilder.comment(source,start+4,end-start-4);
29141
+ return end+3;
29142
+ }else{
29143
+ errorHandler.error("Unclosed comment");
29144
+ return -1;
29145
+ }
29146
+ }else{
29147
+ //error
29148
+ return -1;
29149
+ }
29150
+ default:
29151
+ if(source.substr(start+3,6) == 'CDATA['){
29152
+ var end = source.indexOf(']]>',start+9);
29153
+ domBuilder.startCDATA();
29154
+ domBuilder.characters(source,start+9,end-start-9);
29155
+ domBuilder.endCDATA()
29156
+ return end+3;
29157
+ }
29158
+ //<!DOCTYPE
29159
+ //startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
29160
+ var matchs = split(source,start);
29161
+ var len = matchs.length;
29162
+ if(len>1 && /!doctype/i.test(matchs[0][0])){
29163
+ var name = matchs[1][0];
29164
+ var pubid = false;
29165
+ var sysid = false;
29166
+ if(len>3){
29167
+ if(/^public$/i.test(matchs[2][0])){
29168
+ pubid = matchs[3][0];
29169
+ sysid = len>4 && matchs[4][0];
29170
+ }else if(/^system$/i.test(matchs[2][0])){
29171
+ sysid = matchs[3][0];
29172
+ }
29173
+ }
29174
+ var lastMatch = matchs[len-1]
29175
+ domBuilder.startDTD(name, pubid, sysid);
29176
+ domBuilder.endDTD();
29177
+
29178
+ return lastMatch.index+lastMatch[0].length
29179
+ }
29180
+ }
29181
+ return -1;
29182
+ }
29183
+
29184
+
29185
+
29186
+ function parseInstruction(source,start,domBuilder){
29187
+ var end = source.indexOf('?>',start);
29188
+ if(end){
29189
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
29190
+ if(match){
29191
+ var len = match[0].length;
29192
+ domBuilder.processingInstruction(match[1], match[2]) ;
29193
+ return end+2;
29194
+ }else{//error
29195
+ return -1;
29196
+ }
29197
+ }
29198
+ return -1;
29199
+ }
29200
+
29201
+ function ElementAttributes(){
29202
+ this.attributeNames = {}
29203
+ }
29204
+ ElementAttributes.prototype = {
29205
+ setTagName:function(tagName){
29206
+ if(!tagNamePattern.test(tagName)){
29207
+ throw new Error('invalid tagName:'+tagName)
29208
+ }
29209
+ this.tagName = tagName
29210
+ },
29211
+ addValue:function(qName, value, offset) {
29212
+ if(!tagNamePattern.test(qName)){
29213
+ throw new Error('invalid attribute:'+qName)
29214
+ }
29215
+ this.attributeNames[qName] = this.length;
29216
+ this[this.length++] = {qName:qName,value:value,offset:offset}
29217
+ },
29218
+ length:0,
29219
+ getLocalName:function(i){return this[i].localName},
29220
+ getLocator:function(i){return this[i].locator},
29221
+ getQName:function(i){return this[i].qName},
29222
+ getURI:function(i){return this[i].uri},
29223
+ getValue:function(i){return this[i].value}
29224
+ // ,getIndex:function(uri, localName)){
29225
+ // if(localName){
29226
+ //
29227
+ // }else{
29228
+ // var qName = uri
29229
+ // }
29230
+ // },
29231
+ // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
29232
+ // getType:function(uri,localName){}
29233
+ // getType:function(i){},
29234
+ }
29235
+
29236
+
29237
+
29238
+ function split(source,start){
29239
+ var match;
29240
+ var buf = [];
29241
+ var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
29242
+ reg.lastIndex = start;
29243
+ reg.exec(source);//skip <
29244
+ while(match = reg.exec(source)){
29245
+ buf.push(match);
29246
+ if(match[1])return buf;
29247
+ }
29248
+ }
29249
+
29250
+ exports.XMLReader = XMLReader;
29251
+ exports.ParseError = ParseError;
29252
+
29253
+
26261
29254
  /***/ }),
26262
29255
 
26263
29256
  /***/ "./node_modules/async/dist/async.mjs":
@@ -61583,10 +64576,11 @@ var XMLHandler = /*#__PURE__*/function (_Handler3) {
61583
64576
  // figure out the root element
61584
64577
 
61585
64578
  for (var c = 0; c < dom.childNodes.length; c++) {
61586
- // is this node an element?
61587
- if (dom.childNodes[c].nodeType === 1) {
64579
+ var node = dom.childNodes[c]; // is this node an element?
64580
+
64581
+ if (XMLHandler.isElement(node)) {
61588
64582
  // We've found the first element, it's the root
61589
- var _ns = dom.childNodes[c].namespaceURI; // Is it RDF/XML?
64583
+ var _ns = node.namespaceURI; // Is it RDF/XML?
61590
64584
 
61591
64585
  if (_ns && _ns === _ns['rdf']) {
61592
64586
  fetcher.addStatus(options.req, 'Has XML root element in the RDF namespace, so assume RDF/XML.');
@@ -61646,6 +64640,11 @@ var XMLHandler = /*#__PURE__*/function (_Handler3) {
61646
64640
  'q': 0.5
61647
64641
  };
61648
64642
  }
64643
+ }, {
64644
+ key: "isElement",
64645
+ value: function isElement(node) {
64646
+ return node.nodeType === Node.ELEMENT_NODE;
64647
+ }
61649
64648
  }]);
61650
64649
 
61651
64650
  return XMLHandler;
@@ -75629,8 +78628,8 @@ __webpack_require__.r(__webpack_exports__);
75629
78628
 
75630
78629
  /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "uri", function() { return _uri__WEBPACK_IMPORTED_MODULE_0__; });
75631
78630
  /* harmony import */ var _named_node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./named-node */ "./node_modules/rdflib/esm/named-node.js");
75632
- /* harmony import */ var xmldom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! xmldom */ "xmldom");
75633
- /* harmony import */ var xmldom__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(xmldom__WEBPACK_IMPORTED_MODULE_3__);
78631
+ /* harmony import */ var _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @xmldom/xmldom */ "./node_modules/@xmldom/xmldom/lib/index.js");
78632
+ /* harmony import */ var _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__);
75634
78633
  /**
75635
78634
  * Utility functions for $rdf
75636
78635
  * @module util
@@ -75725,7 +78724,7 @@ function callbackify(obj, callbacks) {
75725
78724
 
75726
78725
  function DOMParserFactory() {
75727
78726
  if (window.DOMParser) {
75728
- return new xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"]();
78727
+ return new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"]();
75729
78728
  } else if (window.ActiveXObject) {
75730
78729
  return new ActiveXObject('Microsoft.XMLDOM');
75731
78730
  } else {
@@ -75888,7 +78887,7 @@ function output(o) {
75888
78887
  }
75889
78888
 
75890
78889
  /**
75891
- * Returns a DOM from parsex XML.
78890
+ * Returns a DOM from parsed XML.
75892
78891
  */
75893
78892
 
75894
78893
  function parseXML(str, options) {
@@ -75897,13 +78896,13 @@ function parseXML(str, options) {
75897
78896
 
75898
78897
  if ( true && module && module.exports) {
75899
78898
  // Node.js
75900
- var dom = new xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"]().parseFromString(str, options.contentType || 'application/xhtml+xml');
78899
+ var dom = new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"]().parseFromString(str, options.contentType || 'application/xhtml+xml');
75901
78900
  return dom;
75902
78901
  } else {
75903
78902
  if (typeof window !== 'undefined' && window.DOMParser) {
75904
78903
  dparser = new window.DOMParser(); // seems to actually work
75905
78904
  } else {
75906
- dparser = new xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"](); // Doc says this works
78905
+ dparser = new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__["DOMParser"](); // Doc says this works
75907
78906
  }
75908
78907
  }
75909
78908
 
@@ -83994,17 +86993,6 @@ try {
83994
86993
 
83995
86994
  /* (ignored) */
83996
86995
 
83997
- /***/ }),
83998
-
83999
- /***/ "xmldom":
84000
- /*!*************************!*\
84001
- !*** external "window" ***!
84002
- \*************************/
84003
- /*! no static exports found */
84004
- /***/ (function(module, exports) {
84005
-
84006
- module.exports = window;
84007
-
84008
86996
  /***/ })
84009
86997
 
84010
86998
  /******/ });