@italia/video 1.0.0-beta.3 → 1.0.0-beta.4
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.
- package/dist/src/it-video.js +186 -31
- package/dist/src/it-video.js.map +1 -1
- package/package.json +9 -9
package/dist/src/it-video.js
CHANGED
|
@@ -6189,11 +6189,22 @@ function requireConventions () {
|
|
|
6189
6189
|
XMLNS: 'http://www.w3.org/2000/xmlns/',
|
|
6190
6190
|
});
|
|
6191
6191
|
|
|
6192
|
+
//[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]
|
|
6193
|
+
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
|
6194
|
+
//[5] Name ::= NameStartChar (NameChar)*
|
|
6195
|
+
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
|
|
6196
|
+
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
|
6197
|
+
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
|
|
6198
|
+
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
|
|
6199
|
+
|
|
6192
6200
|
conventions.assign = assign;
|
|
6193
6201
|
conventions.find = find;
|
|
6194
6202
|
conventions.freeze = freeze;
|
|
6195
6203
|
conventions.MIME_TYPE = MIME_TYPE;
|
|
6196
6204
|
conventions.NAMESPACE = NAMESPACE;
|
|
6205
|
+
conventions.nameStartChar = nameStartChar;
|
|
6206
|
+
conventions.nameChar = nameChar;
|
|
6207
|
+
conventions.tagNamePattern = tagNamePattern;
|
|
6197
6208
|
return conventions;
|
|
6198
6209
|
}
|
|
6199
6210
|
|
|
@@ -6206,6 +6217,7 @@ function requireDom () {
|
|
|
6206
6217
|
|
|
6207
6218
|
var find = conventions.find;
|
|
6208
6219
|
var NAMESPACE = conventions.NAMESPACE;
|
|
6220
|
+
var tagNamePattern = conventions.tagNamePattern;
|
|
6209
6221
|
|
|
6210
6222
|
/**
|
|
6211
6223
|
* A prerequisite for `[].filter`, to drop elements that are empty
|
|
@@ -6437,6 +6449,13 @@ function requireDom () {
|
|
|
6437
6449
|
* used for attributes or DocumentType entities
|
|
6438
6450
|
*/
|
|
6439
6451
|
function NamedNodeMap() {
|
|
6452
|
+
// nodeName -> Attr membership index; lets the parse-time de-duplication in
|
|
6453
|
+
// setNamedItem resolve an existing attribute in O(1) instead of scanning the
|
|
6454
|
+
// list, so building an element with M attributes costs O(M) rather than O(M^2).
|
|
6455
|
+
// The numbered entries and length remain the sole authority for attribute order.
|
|
6456
|
+
// Object.create(null) so an attribute named __proto__ or constructor is an
|
|
6457
|
+
// ordinary key.
|
|
6458
|
+
this._nameIndex = Object.create(null);
|
|
6440
6459
|
}
|
|
6441
6460
|
function _findNodeIndex(list,node){
|
|
6442
6461
|
var i = list.length;
|
|
@@ -6445,12 +6464,27 @@ function requireDom () {
|
|
|
6445
6464
|
}
|
|
6446
6465
|
}
|
|
6447
6466
|
|
|
6467
|
+
function _nnmIndexAdd(list, attr) {
|
|
6468
|
+
list._nameIndex[attr.nodeName] = attr;
|
|
6469
|
+
}
|
|
6470
|
+
function _nnmIndexRemove(list, attr) {
|
|
6471
|
+
// Only drop the entry if it still points at this attribute; a replacement with
|
|
6472
|
+
// a different nodeName may already have re-keyed it.
|
|
6473
|
+
if (list._nameIndex[attr.nodeName] === attr) {
|
|
6474
|
+
delete list._nameIndex[attr.nodeName];
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
|
|
6448
6478
|
function _addNamedNode(el,list,newAttr,oldAttr){
|
|
6449
6479
|
if(oldAttr){
|
|
6450
6480
|
list[_findNodeIndex(list,oldAttr)] = newAttr;
|
|
6481
|
+
// oldAttr leaves the list; drop its index entry (its nodeName may differ
|
|
6482
|
+
// from newAttr's when the replacement came via setNamedItemNS).
|
|
6483
|
+
_nnmIndexRemove(list, oldAttr);
|
|
6451
6484
|
}else {
|
|
6452
6485
|
list[list.length++] = newAttr;
|
|
6453
6486
|
}
|
|
6487
|
+
_nnmIndexAdd(list, newAttr);
|
|
6454
6488
|
if(el){
|
|
6455
6489
|
newAttr.ownerElement = el;
|
|
6456
6490
|
var doc = el.ownerDocument;
|
|
@@ -6469,6 +6503,7 @@ function requireDom () {
|
|
|
6469
6503
|
list[i] = list[++i];
|
|
6470
6504
|
}
|
|
6471
6505
|
list.length = lastIndex;
|
|
6506
|
+
_nnmIndexRemove(list, attr);
|
|
6472
6507
|
if(el){
|
|
6473
6508
|
var doc = el.ownerDocument;
|
|
6474
6509
|
if(doc){
|
|
@@ -6502,7 +6537,11 @@ function requireDom () {
|
|
|
6502
6537
|
if(el && el!=this._ownerElement){
|
|
6503
6538
|
throw new DOMException(INUSE_ATTRIBUTE_ERR);
|
|
6504
6539
|
}
|
|
6505
|
-
|
|
6540
|
+
// Resolve any existing attribute with the same nodeName through the O(1)
|
|
6541
|
+
// membership index rather than an O(M) scan — this is the parse-dedup hot
|
|
6542
|
+
// path (setAttributeNode per attribute during parse). Absent -> undefined,
|
|
6543
|
+
// matching getNamedItem's contract.
|
|
6544
|
+
var oldAttr = this._nameIndex[attr.nodeName];
|
|
6506
6545
|
_addNamedNode(this._ownerElement,this,attr,oldAttr);
|
|
6507
6546
|
return oldAttr;
|
|
6508
6547
|
},
|
|
@@ -6735,9 +6774,38 @@ function requireDom () {
|
|
|
6735
6774
|
while (child) {
|
|
6736
6775
|
var next = child.nextSibling;
|
|
6737
6776
|
if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
//
|
|
6777
|
+
// Merge the whole run of adjacent text nodes at once: gather the
|
|
6778
|
+
// following text siblings' data, unlink them in a single pass, and
|
|
6779
|
+
// re-index the child list a single time. Per-sibling `removeChild`
|
|
6780
|
+
// (each an O(K) re-index) plus per-sibling `appendData` (each an O(K)
|
|
6781
|
+
// string rebuild) is O(K^2) over a long run of single-character text
|
|
6782
|
+
// nodes; this keeps it O(K). The first text node of the run survives
|
|
6783
|
+
// and carries the concatenated data, preserving node identity and
|
|
6784
|
+
// locator semantics.
|
|
6785
|
+
var tail = [];
|
|
6786
|
+
var sibling = next;
|
|
6787
|
+
while (sibling !== null && sibling.nodeType === TEXT_NODE) {
|
|
6788
|
+
tail.push(sibling.data);
|
|
6789
|
+
sibling = sibling.nextSibling;
|
|
6790
|
+
}
|
|
6791
|
+
// `sibling` is now the first non-text node after the run, or null.
|
|
6792
|
+
var removed = child.nextSibling;
|
|
6793
|
+
while (removed !== sibling) {
|
|
6794
|
+
var following = removed.nextSibling;
|
|
6795
|
+
removed.parentNode = null;
|
|
6796
|
+
removed.previousSibling = null;
|
|
6797
|
+
removed.nextSibling = null;
|
|
6798
|
+
removed = following;
|
|
6799
|
+
}
|
|
6800
|
+
child.nextSibling = sibling;
|
|
6801
|
+
if (sibling !== null) {
|
|
6802
|
+
sibling.previousSibling = child;
|
|
6803
|
+
} else {
|
|
6804
|
+
node.lastChild = child;
|
|
6805
|
+
}
|
|
6806
|
+
child.appendData(tail.join('')); // single O(K) string rebuild
|
|
6807
|
+
_onUpdateChild(node.ownerDocument, node); // single O(K) re-index
|
|
6808
|
+
child = sibling;
|
|
6741
6809
|
} else {
|
|
6742
6810
|
child = next;
|
|
6743
6811
|
}
|
|
@@ -7548,8 +7616,10 @@ function requireDom () {
|
|
|
7548
7616
|
* - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
|
|
7549
7617
|
*
|
|
7550
7618
|
* Note: When the resulting document is serialized with `requireWellFormed: true`, the
|
|
7551
|
-
* serializer throws with code `INVALID_STATE_ERR` if `.
|
|
7552
|
-
*
|
|
7619
|
+
* serializer throws with code `INVALID_STATE_ERR` if `.target` is not a valid XML `NCName`
|
|
7620
|
+
* (a `Name` with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data`
|
|
7621
|
+
* contains `?>` (W3C DOM Parsing §3.2.1.7). Without that option the target and data are
|
|
7622
|
+
* emitted verbatim.
|
|
7553
7623
|
*
|
|
7554
7624
|
* @param {string} target
|
|
7555
7625
|
* @param {string} data
|
|
@@ -7574,7 +7644,27 @@ function requireDom () {
|
|
|
7574
7644
|
node.specified = true;
|
|
7575
7645
|
return node;
|
|
7576
7646
|
},
|
|
7647
|
+
/**
|
|
7648
|
+
* Creates an EntityReference object, serialized as `&name;`.
|
|
7649
|
+
*
|
|
7650
|
+
* The `name` is validated against the XML `Name` production at creation time; an invalid name
|
|
7651
|
+
* throws a `DOMException` with code `INVALID_CHARACTER_ERR`. When the resulting node is
|
|
7652
|
+
* serialized with `requireWellFormed: true`, the serializer re-validates `nodeName` and throws
|
|
7653
|
+
* a `DOMException` with code `INVALID_STATE_ERR` if a later `nodeName` mutation made it invalid;
|
|
7654
|
+
* without that option the name is emitted verbatim.
|
|
7655
|
+
*
|
|
7656
|
+
* Note: xmldom does not expand entities — the parser resolves entity references inline and never
|
|
7657
|
+
* constructs `EntityReference` nodes, so this method is the only producer.
|
|
7658
|
+
*
|
|
7659
|
+
* @param {string} name The name of the entity to reference.
|
|
7660
|
+
* @returns {EntityReference}
|
|
7661
|
+
* @throws {DOMException} With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
|
|
7662
|
+
* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
|
|
7663
|
+
*/
|
|
7577
7664
|
createEntityReference : function(name){
|
|
7665
|
+
if (!tagNamePattern.test(name)) {
|
|
7666
|
+
throw new DOMException(INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
|
|
7667
|
+
}
|
|
7578
7668
|
var node = new EntityReference();
|
|
7579
7669
|
node.ownerDocument = this;
|
|
7580
7670
|
node.nodeName = name;
|
|
@@ -7786,15 +7876,16 @@ function requireDom () {
|
|
|
7786
7876
|
/**
|
|
7787
7877
|
* Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
|
|
7788
7878
|
*
|
|
7789
|
-
* `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
|
|
7879
|
+
* `name`, `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
|
|
7790
7880
|
* xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
|
|
7791
7881
|
* direct property writes succeed silently. Values are serialized verbatim when
|
|
7792
7882
|
* `requireWellFormed` is false (the default). When the serializer is invoked with
|
|
7793
7883
|
* `requireWellFormed: true` (via the 4th-parameter options object), it validates each
|
|
7794
|
-
* field
|
|
7884
|
+
* field — including `name`, which is checked against the XML `Name` production — and throws
|
|
7885
|
+
* `DOMException` with code `INVALID_STATE_ERR` on invalid values.
|
|
7795
7886
|
*
|
|
7796
7887
|
* @class
|
|
7797
|
-
* @see https://developer.mozilla.org/
|
|
7888
|
+
* @see https://developer.mozilla.org/docs/Web/API/DocumentType MDN
|
|
7798
7889
|
*/
|
|
7799
7890
|
function DocumentType() {
|
|
7800
7891
|
} DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
|
|
@@ -7808,6 +7899,20 @@ function requireDom () {
|
|
|
7808
7899
|
} Entity.prototype.nodeType = ENTITY_NODE;
|
|
7809
7900
|
_extends(Entity,Node);
|
|
7810
7901
|
|
|
7902
|
+
/**
|
|
7903
|
+
* Represents an EntityReference node, serialized as `&nodeName;`.
|
|
7904
|
+
*
|
|
7905
|
+
* `nodeName` is the referenced entity's name, stored verbatim. When serialized with
|
|
7906
|
+
* `requireWellFormed: true`, the serializer validates `nodeName` against the XML `Name` production
|
|
7907
|
+
* and throws a `DOMException` with code `INVALID_STATE_ERR` if it does not match; without that
|
|
7908
|
+
* option the name is emitted verbatim between `&` and `;`.
|
|
7909
|
+
*
|
|
7910
|
+
* Note: xmldom does not expand entities — the parser resolves entity references inline and never
|
|
7911
|
+
* constructs `EntityReference` nodes, so the only producer is `Document.createEntityReference`.
|
|
7912
|
+
*
|
|
7913
|
+
* @class
|
|
7914
|
+
* @see https://www.w3.org/TR/xml/#NT-Name
|
|
7915
|
+
*/
|
|
7811
7916
|
function EntityReference() {
|
|
7812
7917
|
} EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
|
|
7813
7918
|
_extends(EntityReference,Node);
|
|
@@ -7845,14 +7950,20 @@ function requireDom () {
|
|
|
7845
7950
|
* @returns {string}
|
|
7846
7951
|
* @throws {DOMException}
|
|
7847
7952
|
* With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
|
|
7953
|
+
* - an Element's qualified name (including any namespace prefix) is not a valid XML QName,
|
|
7954
|
+
* - an attribute's qualified name (including a synthesized `xmlns:` namespace declaration) is
|
|
7955
|
+
* not a valid XML QName,
|
|
7848
7956
|
* - a CDATASection node's data contains `"]]>"`,
|
|
7849
7957
|
* - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
|
|
7850
|
-
* - a ProcessingInstruction's
|
|
7958
|
+
* - a ProcessingInstruction's target is not a valid XML `NCName` (a `Name` with no colon) or is
|
|
7959
|
+
* an ASCII case-insensitive match for `"xml"`, or its data contains `"?>"`,
|
|
7960
|
+
* - a DocumentType's `name` is not a valid XML `Name` (XML 1.0 production [5]),
|
|
7851
7961
|
* - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
|
|
7852
7962
|
* production,
|
|
7853
7963
|
* - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
|
|
7854
|
-
* production,
|
|
7855
|
-
* - a DocumentType's `internalSubset` contains `"]>"
|
|
7964
|
+
* production,
|
|
7965
|
+
* - a DocumentType's `internalSubset` contains `"]>"`, or
|
|
7966
|
+
* - an EntityReference's `nodeName` is not a valid XML `Name` (XML 1.0 production [5]).
|
|
7856
7967
|
* Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
|
|
7857
7968
|
* writes succeed and are covered by the serializer-level checks above.
|
|
7858
7969
|
* @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
|
|
@@ -7926,7 +8037,10 @@ function requireDom () {
|
|
|
7926
8037
|
* @see https://www.w3.org/TR/xml11/#AVNormalize
|
|
7927
8038
|
* @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
|
|
7928
8039
|
*/
|
|
7929
|
-
function addSerializedAttribute(buf, qualifiedName, value) {
|
|
8040
|
+
function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
|
|
8041
|
+
if (requireWellFormed && !tagNamePattern.test(qualifiedName)) {
|
|
8042
|
+
throw new DOMException(INVALID_STATE_ERR, 'The attribute name "' + qualifiedName + '" is not a valid XML QName');
|
|
8043
|
+
}
|
|
7930
8044
|
buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
|
|
7931
8045
|
}
|
|
7932
8046
|
|
|
@@ -7992,6 +8106,9 @@ function requireDom () {
|
|
|
7992
8106
|
}
|
|
7993
8107
|
}
|
|
7994
8108
|
|
|
8109
|
+
if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) {
|
|
8110
|
+
throw new DOMException(INVALID_STATE_ERR, 'The element name "' + prefixedNodeName + '" is not a valid XML QName');
|
|
8111
|
+
}
|
|
7995
8112
|
buf.push('<', prefixedNodeName);
|
|
7996
8113
|
|
|
7997
8114
|
// Build a fresh namespace snapshot for this element's children.
|
|
@@ -8011,7 +8128,7 @@ function requireDom () {
|
|
|
8011
8128
|
if (needNamespaceDefine(attr, html, childNs)) {
|
|
8012
8129
|
var attrPrefix = attr.prefix || '';
|
|
8013
8130
|
var uri = attr.namespaceURI;
|
|
8014
|
-
addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
|
|
8131
|
+
addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri, requireWellFormed);
|
|
8015
8132
|
childNs.push({ prefix: attrPrefix, namespace: uri });
|
|
8016
8133
|
}
|
|
8017
8134
|
// Apply nodeFilter and serialize the attribute.
|
|
@@ -8020,7 +8137,7 @@ function requireDom () {
|
|
|
8020
8137
|
if (typeof filteredAttr === 'string') {
|
|
8021
8138
|
buf.push(filteredAttr);
|
|
8022
8139
|
} else {
|
|
8023
|
-
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
|
|
8140
|
+
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
|
|
8024
8141
|
}
|
|
8025
8142
|
}
|
|
8026
8143
|
}
|
|
@@ -8029,7 +8146,7 @@ function requireDom () {
|
|
|
8029
8146
|
if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
|
|
8030
8147
|
var nodePrefix = n.prefix || '';
|
|
8031
8148
|
var uri = n.namespaceURI;
|
|
8032
|
-
addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
|
|
8149
|
+
addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri, requireWellFormed);
|
|
8033
8150
|
childNs.push({ prefix: nodePrefix, namespace: uri });
|
|
8034
8151
|
}
|
|
8035
8152
|
|
|
@@ -8062,7 +8179,7 @@ function requireDom () {
|
|
|
8062
8179
|
return { ns: ns.slice(), isHTML: html, tag: null };
|
|
8063
8180
|
|
|
8064
8181
|
case ATTRIBUTE_NODE:
|
|
8065
|
-
addSerializedAttribute(buf, n.name, n.value);
|
|
8182
|
+
addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
|
|
8066
8183
|
return null;
|
|
8067
8184
|
|
|
8068
8185
|
case TEXT_NODE:
|
|
@@ -8101,6 +8218,9 @@ function requireDom () {
|
|
|
8101
8218
|
|
|
8102
8219
|
case DOCUMENT_TYPE_NODE:
|
|
8103
8220
|
if (requireWellFormed) {
|
|
8221
|
+
if (!tagNamePattern.test(n.name)) {
|
|
8222
|
+
throw new DOMException(INVALID_STATE_ERR, 'The doctype name "' + n.name + '" is not a valid XML Name');
|
|
8223
|
+
}
|
|
8104
8224
|
if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
|
|
8105
8225
|
throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
|
|
8106
8226
|
}
|
|
@@ -8132,13 +8252,27 @@ function requireDom () {
|
|
|
8132
8252
|
return null;
|
|
8133
8253
|
|
|
8134
8254
|
case PROCESSING_INSTRUCTION_NODE:
|
|
8135
|
-
if (requireWellFormed
|
|
8136
|
-
|
|
8255
|
+
if (requireWellFormed) {
|
|
8256
|
+
if (!tagNamePattern.test(n.target) || n.target.indexOf(':') !== -1 || n.target.toLowerCase() === 'xml') {
|
|
8257
|
+
throw new DOMException(
|
|
8258
|
+
INVALID_STATE_ERR,
|
|
8259
|
+
'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved'
|
|
8260
|
+
);
|
|
8261
|
+
}
|
|
8262
|
+
if (n.data.indexOf('?>') !== -1) {
|
|
8263
|
+
throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
|
|
8264
|
+
}
|
|
8137
8265
|
}
|
|
8138
8266
|
buf.push('<?', n.target, ' ', n.data, '?>');
|
|
8139
8267
|
return null;
|
|
8140
8268
|
|
|
8141
8269
|
case ENTITY_REFERENCE_NODE:
|
|
8270
|
+
if (requireWellFormed && !tagNamePattern.test(n.nodeName)) {
|
|
8271
|
+
throw new DOMException(
|
|
8272
|
+
INVALID_STATE_ERR,
|
|
8273
|
+
'The entity reference name "' + n.nodeName + '" is not a valid XML Name'
|
|
8274
|
+
);
|
|
8275
|
+
}
|
|
8142
8276
|
buf.push('&', n.nodeName, ';');
|
|
8143
8277
|
return null;
|
|
8144
8278
|
|
|
@@ -10519,14 +10653,8 @@ function requireSax () {
|
|
|
10519
10653
|
if (hasRequiredSax) return sax;
|
|
10520
10654
|
hasRequiredSax = 1;
|
|
10521
10655
|
var NAMESPACE = requireConventions().NAMESPACE;
|
|
10656
|
+
var tagNamePattern = requireConventions().tagNamePattern;
|
|
10522
10657
|
|
|
10523
|
-
//[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]
|
|
10524
|
-
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
|
10525
|
-
//[5] Name ::= NameStartChar (NameChar)*
|
|
10526
|
-
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
|
|
10527
|
-
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
|
10528
|
-
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
|
|
10529
|
-
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
|
|
10530
10658
|
//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(',')
|
|
10531
10659
|
|
|
10532
10660
|
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
|
@@ -10637,7 +10765,13 @@ function requireSax () {
|
|
|
10637
10765
|
switch(source.charAt(tagStart+1)){
|
|
10638
10766
|
case '/':
|
|
10639
10767
|
var end = source.indexOf('>',tagStart+3);
|
|
10640
|
-
|
|
10768
|
+
// Anchored trailing-whitespace trim. The former `/[ \t\n\r]+$/g` backtracked
|
|
10769
|
+
// quadratically on a name shaped `whitespace-run + non-whitespace char`
|
|
10770
|
+
// (an end tag `</ … x>`): from every start position it extended `[ws]+`
|
|
10771
|
+
// to the end and then failed the `$` anchor. This anchored form matches the
|
|
10772
|
+
// whole string once and captures everything up to the last non-whitespace
|
|
10773
|
+
// character, so it trims in linear time with byte-identical output.
|
|
10774
|
+
var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, '$1');
|
|
10641
10775
|
var config = parseStack.pop();
|
|
10642
10776
|
if(end<0){
|
|
10643
10777
|
|
|
@@ -10648,6 +10782,14 @@ function requireSax () {
|
|
|
10648
10782
|
tagName = tagName.replace(/[\s<].*/,'');
|
|
10649
10783
|
errorHandler.error("end tag name: "+tagName+' maybe not complete');
|
|
10650
10784
|
end = tagStart+1+tagName.length;
|
|
10785
|
+
}else if(/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])){
|
|
10786
|
+
// The XML `ETag` production is `'</' Name S? '>'`: only optional whitespace may follow
|
|
10787
|
+
// the `Name`. A valid `Name` followed by whitespace and non-whitespace residue (e.g.
|
|
10788
|
+
// `</a\nbogus>` or `</a bogus>`) is not well-formed, but historically it was silently
|
|
10789
|
+
// accepted (the malformed end tag ignored, the residue dropped, the element left on the
|
|
10790
|
+
// stack). Report it as a recoverable `error` (which a custom errorHandler may escalate to
|
|
10791
|
+
// fatal) while keeping the existing recovery so the parsed DOM stays byte-identical.
|
|
10792
|
+
errorHandler.error('end tag name is followed by whitespace and trailing content: "'+tagName+'"');
|
|
10651
10793
|
}
|
|
10652
10794
|
var localNSMap = config.localNSMap;
|
|
10653
10795
|
var endMatch = config.tagName == tagName;
|
|
@@ -10771,6 +10913,15 @@ function requireSax () {
|
|
|
10771
10913
|
var s = S_TAG;//status
|
|
10772
10914
|
while(true){
|
|
10773
10915
|
var c = source.charAt(p);
|
|
10916
|
+
if (s === S_TAG && c === '<') {
|
|
10917
|
+
// A `<` can never occur inside a tag name. Without this guard the scan runs
|
|
10918
|
+
// on to the next `>` (or EOF) before the tag name is rejected, so a document
|
|
10919
|
+
// with many `<` inside a malformed tag makes each one-character recovery step
|
|
10920
|
+
// re-scan to the distant `>` — O(n^2). Stopping at the `<` keeps each recovery
|
|
10921
|
+
// step bounded. The candidate scanned so far is reported raw, consistent with
|
|
10922
|
+
// the sibling invalid-tag-name throw below.
|
|
10923
|
+
throw new Error('unexpected < in tag name: ' + source.slice(start, p));
|
|
10924
|
+
}
|
|
10774
10925
|
switch(c){
|
|
10775
10926
|
case '=':
|
|
10776
10927
|
if(s === S_ATTR){//attrName
|
|
@@ -10963,9 +11114,13 @@ function requireSax () {
|
|
|
10963
11114
|
if(nsPrefix !== false){//hack!!
|
|
10964
11115
|
if(localNSMap == null){
|
|
10965
11116
|
localNSMap = {};
|
|
10966
|
-
//
|
|
10967
|
-
|
|
10968
|
-
//
|
|
11117
|
+
// Derive the child scope's namespace map by prototype-chain inheritance
|
|
11118
|
+
// instead of a flat copy: lookups inherit ancestor prefixes transparently,
|
|
11119
|
+
// so a document nesting N scopes retains O(N) map entries rather than
|
|
11120
|
+
// sum(1..N) = O(N^2). localNSMap stays a flat own-only record of the
|
|
11121
|
+
// prefixes declared at THIS element, so own-property enumeration
|
|
11122
|
+
// (endPrefixMapping below) still reports only local declarations.
|
|
11123
|
+
currentNSMap = Object.create(currentNSMap);
|
|
10969
11124
|
}
|
|
10970
11125
|
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
|
10971
11126
|
a.uri = NAMESPACE.XMLNS;
|
|
@@ -71482,7 +71637,7 @@ if (typeof window !== 'undefined') {
|
|
|
71482
71637
|
window._itAnalytics = window._itAnalytics || {};
|
|
71483
71638
|
window._itAnalytics = {
|
|
71484
71639
|
...window._itAnalytics,
|
|
71485
|
-
version: '1.0.0-beta.
|
|
71640
|
+
version: '1.0.0-beta.4',
|
|
71486
71641
|
};
|
|
71487
71642
|
}
|
|
71488
71643
|
|