@italia/video 1.0.0-alpha.17 → 1.0.0-alpha.18
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 +672 -321
- package/dist/src/it-video.js.map +1 -1
- package/package.json +9 -9
package/dist/src/it-video.js
CHANGED
|
@@ -6315,14 +6315,14 @@ function requireDom () {
|
|
|
6315
6315
|
ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
|
|
6316
6316
|
var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
|
|
6317
6317
|
ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
|
|
6318
|
-
ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
|
|
6318
|
+
var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
|
|
6319
6319
|
ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
|
|
6320
6320
|
ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
|
|
6321
6321
|
var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
|
|
6322
6322
|
ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
|
|
6323
6323
|
var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
|
|
6324
6324
|
//level2
|
|
6325
|
-
ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
|
|
6325
|
+
var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
|
|
6326
6326
|
ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
|
|
6327
6327
|
ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
|
|
6328
6328
|
ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
|
|
@@ -6372,9 +6372,10 @@ function requireDom () {
|
|
|
6372
6372
|
item: function(index) {
|
|
6373
6373
|
return index >= 0 && index < this.length ? this[index] : null;
|
|
6374
6374
|
},
|
|
6375
|
-
toString:function(isHTML,nodeFilter){
|
|
6375
|
+
toString:function(isHTML,nodeFilter,options){
|
|
6376
|
+
var requireWellFormed = !!options && !!options.requireWellFormed;
|
|
6376
6377
|
for(var buf = [], i = 0;i<this.length;i++){
|
|
6377
|
-
serializeToString(this[i],buf,isHTML,nodeFilter);
|
|
6378
|
+
serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
|
|
6378
6379
|
}
|
|
6379
6380
|
return buf.join('');
|
|
6380
6381
|
},
|
|
@@ -6619,13 +6620,28 @@ function requireDom () {
|
|
|
6619
6620
|
/**
|
|
6620
6621
|
* Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
|
|
6621
6622
|
*
|
|
6622
|
-
* __This
|
|
6623
|
+
* __This implementation differs from the specification:__
|
|
6623
6624
|
* - this implementation is not validating names or qualified names
|
|
6624
6625
|
* (when parsing XML strings, the SAX parser takes care of that)
|
|
6625
6626
|
*
|
|
6627
|
+
* Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
|
|
6628
|
+
* Creation-time validation of `publicId`, `systemId` is not enforced.
|
|
6629
|
+
* The serializer-level check covers all mutation vectors, including direct property writes.
|
|
6630
|
+
* `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
|
|
6631
|
+
* absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
|
|
6632
|
+
* silently omitted from the serialized output.
|
|
6633
|
+
*
|
|
6626
6634
|
* @param {string} qualifiedName
|
|
6627
6635
|
* @param {string} [publicId]
|
|
6636
|
+
* The external subset public identifier. Stored verbatim including surrounding quotes.
|
|
6637
|
+
* When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
|
|
6638
|
+
* throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
|
|
6639
|
+
* not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
|
|
6628
6640
|
* @param {string} [systemId]
|
|
6641
|
+
* The external subset system identifier. Stored verbatim including surrounding quotes.
|
|
6642
|
+
* When serialized with `requireWellFormed: true`, throws `DOMException` with code
|
|
6643
|
+
* `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
|
|
6644
|
+
* production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
|
|
6629
6645
|
* @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
|
|
6630
6646
|
* or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
|
|
6631
6647
|
*
|
|
@@ -6691,18 +6707,44 @@ function requireDom () {
|
|
|
6691
6707
|
return cloneNode(this.ownerDocument||this,this,deep);
|
|
6692
6708
|
},
|
|
6693
6709
|
// Modified in DOM Level 2:
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6710
|
+
/**
|
|
6711
|
+
* Puts the specified node and all of its subtree into a "normalized" form. In a normalized
|
|
6712
|
+
* subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
|
|
6713
|
+
*
|
|
6714
|
+
* Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
|
|
6715
|
+
* is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
|
|
6716
|
+
* nodes.
|
|
6717
|
+
*
|
|
6718
|
+
* This method iteratively traverses all child nodes to normalize all descendant nodes within
|
|
6719
|
+
* the subtree.
|
|
6720
|
+
*
|
|
6721
|
+
* @throws {DOMException}
|
|
6722
|
+
* May throw a DOMException if operations within removeChild or appendData (which are
|
|
6723
|
+
* potentially invoked in this method) do not meet their specific constraints.
|
|
6724
|
+
* @see {@link Node.removeChild}
|
|
6725
|
+
* @see {@link CharacterData.appendData}
|
|
6726
|
+
* @see ../docs/walk-dom.md.
|
|
6727
|
+
*/
|
|
6728
|
+
normalize: function () {
|
|
6729
|
+
walkDOM(this, null, {
|
|
6730
|
+
enter: function (node) {
|
|
6731
|
+
// Merge adjacent text children of node before walkDOM schedules them.
|
|
6732
|
+
// walkDOM reads lastChild/previousSibling after enter returns, so the
|
|
6733
|
+
// surviving post-merge children are what it descends into.
|
|
6734
|
+
var child = node.firstChild;
|
|
6735
|
+
while (child) {
|
|
6736
|
+
var next = child.nextSibling;
|
|
6737
|
+
if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
|
|
6738
|
+
node.removeChild(next);
|
|
6739
|
+
child.appendData(next.data);
|
|
6740
|
+
// Do not advance child: re-check new nextSibling for another text run
|
|
6741
|
+
} else {
|
|
6742
|
+
child = next;
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
return true; // descend into surviving children
|
|
6746
|
+
},
|
|
6747
|
+
});
|
|
6706
6748
|
},
|
|
6707
6749
|
// Introduced in DOM Level 2:
|
|
6708
6750
|
isSupported:function(feature, version){
|
|
@@ -6778,21 +6820,103 @@ function requireDom () {
|
|
|
6778
6820
|
copy(NodeType,Node.prototype);
|
|
6779
6821
|
|
|
6780
6822
|
/**
|
|
6781
|
-
* @param
|
|
6782
|
-
*
|
|
6823
|
+
* @param {Node} node
|
|
6824
|
+
* Root of the subtree to visit.
|
|
6825
|
+
* @param {function(Node): boolean} callback
|
|
6826
|
+
* Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
|
|
6827
|
+
* @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
|
|
6783
6828
|
*/
|
|
6784
|
-
function _visitNode(node,callback){
|
|
6785
|
-
|
|
6786
|
-
return true;
|
|
6787
|
-
}
|
|
6788
|
-
if(node = node.firstChild){
|
|
6789
|
-
do{
|
|
6790
|
-
if(_visitNode(node,callback)){return true}
|
|
6791
|
-
}while(node=node.nextSibling)
|
|
6792
|
-
}
|
|
6829
|
+
function _visitNode(node, callback) {
|
|
6830
|
+
return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
|
|
6793
6831
|
}
|
|
6794
6832
|
|
|
6833
|
+
/**
|
|
6834
|
+
* Depth-first pre/post-order DOM tree walker.
|
|
6835
|
+
*
|
|
6836
|
+
* Visits every node in the subtree rooted at `node`. For each node:
|
|
6837
|
+
*
|
|
6838
|
+
* 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
|
|
6839
|
+
* return value becomes the `context` passed to each child's `enter` call and to the matching
|
|
6840
|
+
* `exit` call.
|
|
6841
|
+
* 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
|
|
6842
|
+
* sibling traversal continues normally.
|
|
6843
|
+
* 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
|
|
6844
|
+
* further `enter` or `exit` calls are made.
|
|
6845
|
+
* 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
|
|
6846
|
+
* safely modify the node's own child list before the walker descends. Modifying siblings of
|
|
6847
|
+
* the current node or any other part of the tree produces unpredictable results: nodes already
|
|
6848
|
+
* queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
|
|
6849
|
+
* the current child list are never visited.
|
|
6850
|
+
* 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
|
|
6851
|
+
* been visited, passing the same `context` that `enter`
|
|
6852
|
+
* returned for that node.
|
|
6853
|
+
*
|
|
6854
|
+
* This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
|
|
6855
|
+
* deep trees.
|
|
6856
|
+
*
|
|
6857
|
+
* @param {Node} node
|
|
6858
|
+
* Root of the subtree to walk.
|
|
6859
|
+
* @param {*} context
|
|
6860
|
+
* Initial context value passed to the root node's `enter`.
|
|
6861
|
+
* @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
|
|
6862
|
+
* @returns {void | walkDOM.STOP}
|
|
6863
|
+
* @see ../docs/walk-dom.md.
|
|
6864
|
+
*/
|
|
6865
|
+
function walkDOM(node, context, callbacks) {
|
|
6866
|
+
// Each stack frame is {node, context, phase}:
|
|
6867
|
+
// walkDOM.ENTER — call enter, then push children
|
|
6868
|
+
// walkDOM.EXIT — call exit
|
|
6869
|
+
var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
|
|
6870
|
+
while (stack.length > 0) {
|
|
6871
|
+
var frame = stack.pop();
|
|
6872
|
+
if (frame.phase === walkDOM.ENTER) {
|
|
6873
|
+
var childContext = callbacks.enter(frame.node, frame.context);
|
|
6874
|
+
if (childContext === walkDOM.STOP) {
|
|
6875
|
+
return walkDOM.STOP;
|
|
6876
|
+
}
|
|
6877
|
+
// Push exit frame before children so it fires after all children are processed (Last In First Out)
|
|
6878
|
+
stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
|
|
6879
|
+
if (childContext === null || childContext === undefined) {
|
|
6880
|
+
continue; // skip children
|
|
6881
|
+
}
|
|
6882
|
+
// lastChild is read after enter returns, so enter may modify the child list.
|
|
6883
|
+
var child = frame.node.lastChild;
|
|
6884
|
+
// Traverse from lastChild backwards so that pushing onto the stack
|
|
6885
|
+
// naturally yields firstChild on top (processed first).
|
|
6886
|
+
while (child) {
|
|
6887
|
+
stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
|
|
6888
|
+
child = child.previousSibling;
|
|
6889
|
+
}
|
|
6890
|
+
} else {
|
|
6891
|
+
// frame.phase === walkDOM.EXIT
|
|
6892
|
+
if (callbacks.exit) {
|
|
6893
|
+
callbacks.exit(frame.node, frame.context);
|
|
6894
|
+
}
|
|
6895
|
+
}
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6795
6898
|
|
|
6899
|
+
/**
|
|
6900
|
+
* Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
|
|
6901
|
+
* immediately.
|
|
6902
|
+
*
|
|
6903
|
+
* @type {symbol}
|
|
6904
|
+
*/
|
|
6905
|
+
walkDOM.STOP = Symbol('walkDOM.STOP');
|
|
6906
|
+
/**
|
|
6907
|
+
* Phase constant for a stack frame that has not yet been visited.
|
|
6908
|
+
* The `enter` callback is called and children are scheduled.
|
|
6909
|
+
*
|
|
6910
|
+
* @type {number}
|
|
6911
|
+
*/
|
|
6912
|
+
walkDOM.ENTER = 0;
|
|
6913
|
+
/**
|
|
6914
|
+
* Phase constant for a stack frame whose subtree has been fully visited.
|
|
6915
|
+
* The `exit` callback is called.
|
|
6916
|
+
*
|
|
6917
|
+
* @type {number}
|
|
6918
|
+
*/
|
|
6919
|
+
walkDOM.EXIT = 1;
|
|
6796
6920
|
|
|
6797
6921
|
function Document(){
|
|
6798
6922
|
this.ownerDocument = this;
|
|
@@ -7396,12 +7520,44 @@ function requireDom () {
|
|
|
7396
7520
|
node.appendData(data);
|
|
7397
7521
|
return node;
|
|
7398
7522
|
},
|
|
7523
|
+
/**
|
|
7524
|
+
* Returns a new CDATASection node whose data is `data`.
|
|
7525
|
+
*
|
|
7526
|
+
* __This implementation differs from the specification:__
|
|
7527
|
+
* - calling this method on an HTML document does not throw `NotSupportedError`.
|
|
7528
|
+
*
|
|
7529
|
+
* @param {string} data
|
|
7530
|
+
* @returns {CDATASection}
|
|
7531
|
+
* @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
|
|
7532
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
|
|
7533
|
+
* @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
|
|
7534
|
+
*/
|
|
7399
7535
|
createCDATASection : function(data){
|
|
7536
|
+
if (data.indexOf(']]>') !== -1) {
|
|
7537
|
+
throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
|
|
7538
|
+
}
|
|
7400
7539
|
var node = new CDATASection();
|
|
7401
7540
|
node.ownerDocument = this;
|
|
7402
7541
|
node.appendData(data);
|
|
7403
7542
|
return node;
|
|
7404
7543
|
},
|
|
7544
|
+
/**
|
|
7545
|
+
* Returns a ProcessingInstruction node whose target is target and data is data.
|
|
7546
|
+
*
|
|
7547
|
+
* __This implementation differs from the specification:__
|
|
7548
|
+
* - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
|
|
7549
|
+
*
|
|
7550
|
+
* Note: When the resulting document is serialized with `requireWellFormed: true`, the
|
|
7551
|
+
* serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
|
|
7552
|
+
* §3.2.1.7). Without that option the data is emitted verbatim.
|
|
7553
|
+
*
|
|
7554
|
+
* @param {string} target
|
|
7555
|
+
* @param {string} data
|
|
7556
|
+
* @returns {ProcessingInstruction}
|
|
7557
|
+
* @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
|
|
7558
|
+
* @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
|
7559
|
+
* @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
|
|
7560
|
+
*/
|
|
7405
7561
|
createProcessingInstruction : function(target,data){
|
|
7406
7562
|
var node = new ProcessingInstruction();
|
|
7407
7563
|
node.ownerDocument = this;
|
|
@@ -7627,6 +7783,19 @@ function requireDom () {
|
|
|
7627
7783
|
_extends(CDATASection,CharacterData);
|
|
7628
7784
|
|
|
7629
7785
|
|
|
7786
|
+
/**
|
|
7787
|
+
* Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
|
|
7788
|
+
*
|
|
7789
|
+
* `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
|
|
7790
|
+
* xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
|
|
7791
|
+
* direct property writes succeed silently. Values are serialized verbatim when
|
|
7792
|
+
* `requireWellFormed` is false (the default). When the serializer is invoked with
|
|
7793
|
+
* `requireWellFormed: true` (via the 4th-parameter options object), it validates each
|
|
7794
|
+
* field and throws `DOMException` with code `INVALID_STATE_ERR` on invalid values.
|
|
7795
|
+
*
|
|
7796
|
+
* @class
|
|
7797
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
|
|
7798
|
+
*/
|
|
7630
7799
|
function DocumentType() {
|
|
7631
7800
|
} DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
|
|
7632
7801
|
_extends(DocumentType,Node);
|
|
@@ -7654,11 +7823,48 @@ function requireDom () {
|
|
|
7654
7823
|
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
|
|
7655
7824
|
_extends(ProcessingInstruction,Node);
|
|
7656
7825
|
function XMLSerializer(){}
|
|
7657
|
-
|
|
7658
|
-
|
|
7826
|
+
/**
|
|
7827
|
+
* Returns the result of serializing `node` to XML.
|
|
7828
|
+
*
|
|
7829
|
+
* When `options.requireWellFormed` is `true`, the serializer throws for content that would
|
|
7830
|
+
* produce ill-formed XML.
|
|
7831
|
+
*
|
|
7832
|
+
* __This implementation differs from the specification:__
|
|
7833
|
+
* - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
|
|
7834
|
+
* at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
|
|
7835
|
+
* default behaviour) unless `requireWellFormed` is `true`.
|
|
7836
|
+
* - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
|
|
7837
|
+
* is only thrown to prevent injection vectors, not for all the spec mandated checks.
|
|
7838
|
+
*
|
|
7839
|
+
* @param {Node} node
|
|
7840
|
+
* @param {boolean} [isHtml]
|
|
7841
|
+
* @param {function} [nodeFilter]
|
|
7842
|
+
* @param {Object} [options]
|
|
7843
|
+
* @param {boolean} [options.requireWellFormed=false]
|
|
7844
|
+
* When `true`, throws for content that would produce ill-formed XML.
|
|
7845
|
+
* @returns {string}
|
|
7846
|
+
* @throws {DOMException}
|
|
7847
|
+
* With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
|
|
7848
|
+
* - a CDATASection node's data contains `"]]>"`,
|
|
7849
|
+
* - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
|
|
7850
|
+
* - a ProcessingInstruction's data contains `"?>"`,
|
|
7851
|
+
* - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
|
|
7852
|
+
* production,
|
|
7853
|
+
* - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
|
|
7854
|
+
* production, or
|
|
7855
|
+
* - a DocumentType's `internalSubset` contains `"]>"`.
|
|
7856
|
+
* Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
|
|
7857
|
+
* writes succeed and are covered by the serializer-level checks above.
|
|
7858
|
+
* @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
|
|
7859
|
+
* @see https://w3c.github.io/DOM-Parsing/#xml-serialization
|
|
7860
|
+
* @see https://github.com/w3c/DOM-Parsing/issues/84
|
|
7861
|
+
*/
|
|
7862
|
+
XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
|
|
7863
|
+
return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
|
|
7659
7864
|
};
|
|
7660
7865
|
Node.prototype.toString = nodeSerializeToString;
|
|
7661
|
-
function nodeSerializeToString(isHtml,nodeFilter){
|
|
7866
|
+
function nodeSerializeToString(isHtml,nodeFilter,options){
|
|
7867
|
+
var requireWellFormed = !!options && !!options.requireWellFormed;
|
|
7662
7868
|
var buf = [];
|
|
7663
7869
|
var refNode = this.nodeType == 9 && this.documentElement || this;
|
|
7664
7870
|
var prefix = refNode.prefix;
|
|
@@ -7675,7 +7881,7 @@ function requireDom () {
|
|
|
7675
7881
|
];
|
|
7676
7882
|
}
|
|
7677
7883
|
}
|
|
7678
|
-
serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
|
|
7884
|
+
serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
|
|
7679
7885
|
//console.log('###',this.nodeType,uri,prefix,buf.join(''))
|
|
7680
7886
|
return buf.join('');
|
|
7681
7887
|
}
|
|
@@ -7724,271 +7930,323 @@ function requireDom () {
|
|
|
7724
7930
|
buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
|
|
7725
7931
|
}
|
|
7726
7932
|
|
|
7727
|
-
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
|
7933
|
+
function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
|
|
7728
7934
|
if (!visibleNamespaces) {
|
|
7729
7935
|
visibleNamespaces = [];
|
|
7730
7936
|
}
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
//buf.sort.apply(attrs, attributeSorter);
|
|
7743
|
-
}
|
|
7744
|
-
|
|
7745
|
-
switch(node.nodeType){
|
|
7746
|
-
case ELEMENT_NODE:
|
|
7747
|
-
var attrs = node.attributes;
|
|
7748
|
-
var len = attrs.length;
|
|
7749
|
-
var child = node.firstChild;
|
|
7750
|
-
var nodeName = node.tagName;
|
|
7751
|
-
|
|
7752
|
-
isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
|
|
7753
|
-
|
|
7754
|
-
var prefixedNodeName = nodeName;
|
|
7755
|
-
if (!isHTML && !node.prefix && node.namespaceURI) {
|
|
7756
|
-
var defaultNS;
|
|
7757
|
-
// lookup current default ns from `xmlns` attribute
|
|
7758
|
-
for (var ai = 0; ai < attrs.length; ai++) {
|
|
7759
|
-
if (attrs.item(ai).name === 'xmlns') {
|
|
7760
|
-
defaultNS = attrs.item(ai).value;
|
|
7761
|
-
break
|
|
7762
|
-
}
|
|
7763
|
-
}
|
|
7764
|
-
if (!defaultNS) {
|
|
7765
|
-
// lookup current default ns in visibleNamespaces
|
|
7766
|
-
for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
|
|
7767
|
-
var namespace = visibleNamespaces[nsi];
|
|
7768
|
-
if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
|
|
7769
|
-
defaultNS = namespace.namespace;
|
|
7770
|
-
break
|
|
7937
|
+
walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
|
|
7938
|
+
enter: function (n, ctx) {
|
|
7939
|
+
var ns = ctx.ns;
|
|
7940
|
+
var html = ctx.isHTML;
|
|
7941
|
+
|
|
7942
|
+
if (nodeFilter) {
|
|
7943
|
+
n = nodeFilter(n);
|
|
7944
|
+
if (n) {
|
|
7945
|
+
if (typeof n == 'string') {
|
|
7946
|
+
buf.push(n);
|
|
7947
|
+
return null;
|
|
7771
7948
|
}
|
|
7949
|
+
} else {
|
|
7950
|
+
return null;
|
|
7772
7951
|
}
|
|
7773
7952
|
}
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7953
|
+
|
|
7954
|
+
switch (n.nodeType) {
|
|
7955
|
+
case ELEMENT_NODE:
|
|
7956
|
+
var attrs = n.attributes;
|
|
7957
|
+
var len = attrs.length;
|
|
7958
|
+
var nodeName = n.tagName;
|
|
7959
|
+
|
|
7960
|
+
html = NAMESPACE.isHTML(n.namespaceURI) || html;
|
|
7961
|
+
|
|
7962
|
+
var prefixedNodeName = nodeName;
|
|
7963
|
+
if (!html && !n.prefix && n.namespaceURI) {
|
|
7964
|
+
var defaultNS;
|
|
7965
|
+
// lookup current default ns from `xmlns` attribute
|
|
7966
|
+
for (var ai = 0; ai < attrs.length; ai++) {
|
|
7967
|
+
if (attrs.item(ai).name === 'xmlns') {
|
|
7968
|
+
defaultNS = attrs.item(ai).value;
|
|
7969
|
+
break;
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
if (!defaultNS) {
|
|
7973
|
+
// lookup current default ns in visibleNamespaces
|
|
7974
|
+
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
|
|
7975
|
+
var nsEntry = ns[nsi];
|
|
7976
|
+
if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
|
|
7977
|
+
defaultNS = nsEntry.namespace;
|
|
7978
|
+
break;
|
|
7979
|
+
}
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
if (defaultNS !== n.namespaceURI) {
|
|
7983
|
+
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
|
|
7984
|
+
var nsEntry = ns[nsi];
|
|
7985
|
+
if (nsEntry.namespace === n.namespaceURI) {
|
|
7986
|
+
if (nsEntry.prefix) {
|
|
7987
|
+
prefixedNodeName = nsEntry.prefix + ':' + nodeName;
|
|
7988
|
+
}
|
|
7989
|
+
break;
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7780
7992
|
}
|
|
7781
|
-
break
|
|
7782
7993
|
}
|
|
7783
|
-
}
|
|
7784
|
-
}
|
|
7785
|
-
}
|
|
7786
7994
|
|
|
7787
|
-
|
|
7995
|
+
buf.push('<', prefixedNodeName);
|
|
7996
|
+
|
|
7997
|
+
// Build a fresh namespace snapshot for this element's children.
|
|
7998
|
+
// The slice prevents sibling elements from inheriting each other's declarations.
|
|
7999
|
+
var childNs = ns.slice();
|
|
8000
|
+
for (var i = 0; i < len; i++) {
|
|
8001
|
+
var attr = attrs.item(i);
|
|
8002
|
+
if (attr.prefix == 'xmlns') {
|
|
8003
|
+
childNs.push({ prefix: attr.localName, namespace: attr.value });
|
|
8004
|
+
} else if (attr.nodeName == 'xmlns') {
|
|
8005
|
+
childNs.push({ prefix: '', namespace: attr.value });
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
7788
8008
|
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
8009
|
+
for (var i = 0; i < len; i++) {
|
|
8010
|
+
var attr = attrs.item(i);
|
|
8011
|
+
if (needNamespaceDefine(attr, html, childNs)) {
|
|
8012
|
+
var attrPrefix = attr.prefix || '';
|
|
8013
|
+
var uri = attr.namespaceURI;
|
|
8014
|
+
addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
|
|
8015
|
+
childNs.push({ prefix: attrPrefix, namespace: uri });
|
|
8016
|
+
}
|
|
8017
|
+
// Apply nodeFilter and serialize the attribute.
|
|
8018
|
+
var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
|
|
8019
|
+
if (filteredAttr) {
|
|
8020
|
+
if (typeof filteredAttr === 'string') {
|
|
8021
|
+
buf.push(filteredAttr);
|
|
8022
|
+
} else {
|
|
8023
|
+
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
}
|
|
7798
8027
|
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
}
|
|
7807
|
-
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
7808
|
-
}
|
|
8028
|
+
// add namespace for current node
|
|
8029
|
+
if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
|
|
8030
|
+
var nodePrefix = n.prefix || '';
|
|
8031
|
+
var uri = n.namespaceURI;
|
|
8032
|
+
addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
|
|
8033
|
+
childNs.push({ prefix: nodePrefix, namespace: uri });
|
|
8034
|
+
}
|
|
7809
8035
|
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
8036
|
+
var child = n.firstChild;
|
|
8037
|
+
if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
|
|
8038
|
+
buf.push('>');
|
|
8039
|
+
if (html && /^script$/i.test(nodeName)) {
|
|
8040
|
+
// Inline serialization for <script> children; return null to skip walkDOM descent.
|
|
8041
|
+
while (child) {
|
|
8042
|
+
if (child.data) {
|
|
8043
|
+
buf.push(child.data);
|
|
8044
|
+
} else {
|
|
8045
|
+
serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
|
|
8046
|
+
}
|
|
8047
|
+
child = child.nextSibling;
|
|
8048
|
+
}
|
|
8049
|
+
buf.push('</', nodeName, '>');
|
|
8050
|
+
return null;
|
|
8051
|
+
}
|
|
8052
|
+
// Return child context; walkDOM descends and exit emits the closing tag.
|
|
8053
|
+
return { ns: childNs, isHTML: html, tag: prefixedNodeName };
|
|
8054
|
+
} else {
|
|
8055
|
+
buf.push('/>');
|
|
8056
|
+
return null;
|
|
8057
|
+
}
|
|
7817
8058
|
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
8059
|
+
case DOCUMENT_NODE:
|
|
8060
|
+
case DOCUMENT_FRAGMENT_NODE:
|
|
8061
|
+
// Descend into children; exit is a no-op (tag is null).
|
|
8062
|
+
return { ns: ns.slice(), isHTML: html, tag: null };
|
|
8063
|
+
|
|
8064
|
+
case ATTRIBUTE_NODE:
|
|
8065
|
+
addSerializedAttribute(buf, n.name, n.value);
|
|
8066
|
+
return null;
|
|
8067
|
+
|
|
8068
|
+
case TEXT_NODE:
|
|
8069
|
+
/**
|
|
8070
|
+
* The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
|
|
8071
|
+
* except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
|
|
8072
|
+
* If they are needed elsewhere, they must be escaped using either numeric character references or the strings
|
|
8073
|
+
* `&` and `<` respectively.
|
|
8074
|
+
* The right angle bracket (>) may be represented using the string " > ", and must, for compatibility,
|
|
8075
|
+
* be escaped using either `>` or a character reference when it appears in the string `]]>` in content,
|
|
8076
|
+
* when that string is not marking the end of a CDATA section.
|
|
8077
|
+
*
|
|
8078
|
+
* In the content of elements, character data is any string of characters
|
|
8079
|
+
* which does not contain the start-delimiter of any markup
|
|
8080
|
+
* and does not include the CDATA-section-close delimiter, `]]>`.
|
|
8081
|
+
*
|
|
8082
|
+
* @see https://www.w3.org/TR/xml/#NT-CharData
|
|
8083
|
+
* @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
|
|
8084
|
+
*/
|
|
8085
|
+
buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
|
|
8086
|
+
return null;
|
|
8087
|
+
|
|
8088
|
+
case CDATA_SECTION_NODE:
|
|
8089
|
+
if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
|
|
8090
|
+
throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
|
|
7827
8091
|
}
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
8092
|
+
buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
|
|
8093
|
+
return null;
|
|
8094
|
+
|
|
8095
|
+
case COMMENT_NODE:
|
|
8096
|
+
if (requireWellFormed && n.data.indexOf('-->') !== -1) {
|
|
8097
|
+
throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
|
|
8098
|
+
}
|
|
8099
|
+
buf.push('<!--', n.data, '-->');
|
|
8100
|
+
return null;
|
|
8101
|
+
|
|
8102
|
+
case DOCUMENT_TYPE_NODE:
|
|
8103
|
+
if (requireWellFormed) {
|
|
8104
|
+
if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
|
|
8105
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
|
|
8106
|
+
}
|
|
8107
|
+
if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
|
|
8108
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
|
|
8109
|
+
}
|
|
8110
|
+
if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
|
|
8111
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
|
|
8112
|
+
}
|
|
8113
|
+
}
|
|
8114
|
+
var pubid = n.publicId;
|
|
8115
|
+
var sysid = n.systemId;
|
|
8116
|
+
buf.push('<!DOCTYPE ', n.name);
|
|
8117
|
+
if (pubid) {
|
|
8118
|
+
buf.push(' PUBLIC ', pubid);
|
|
8119
|
+
if (sysid && sysid != '.') {
|
|
8120
|
+
buf.push(' ', sysid);
|
|
8121
|
+
}
|
|
8122
|
+
buf.push('>');
|
|
8123
|
+
} else if (sysid && sysid != '.') {
|
|
8124
|
+
buf.push(' SYSTEM ', sysid, '>');
|
|
8125
|
+
} else {
|
|
8126
|
+
var sub = n.internalSubset;
|
|
8127
|
+
if (sub) {
|
|
8128
|
+
buf.push(' [', sub, ']');
|
|
8129
|
+
}
|
|
8130
|
+
buf.push('>');
|
|
8131
|
+
}
|
|
8132
|
+
return null;
|
|
8133
|
+
|
|
8134
|
+
case PROCESSING_INSTRUCTION_NODE:
|
|
8135
|
+
if (requireWellFormed && n.data.indexOf('?>') !== -1) {
|
|
8136
|
+
throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
|
|
8137
|
+
}
|
|
8138
|
+
buf.push('<?', n.target, ' ', n.data, '?>');
|
|
8139
|
+
return null;
|
|
8140
|
+
|
|
8141
|
+
case ENTITY_REFERENCE_NODE:
|
|
8142
|
+
buf.push('&', n.nodeName, ';');
|
|
8143
|
+
return null;
|
|
8144
|
+
|
|
8145
|
+
//case ENTITY_NODE:
|
|
8146
|
+
//case NOTATION_NODE:
|
|
8147
|
+
default:
|
|
8148
|
+
buf.push('??', n.nodeName);
|
|
8149
|
+
return null;
|
|
7886
8150
|
}
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
var sub = node.internalSubset;
|
|
7892
|
-
if(sub){
|
|
7893
|
-
buf.push(" [",sub,"]");
|
|
8151
|
+
},
|
|
8152
|
+
exit: function (n, childCtx) {
|
|
8153
|
+
if (childCtx && childCtx.tag) {
|
|
8154
|
+
buf.push('</', childCtx.tag, '>');
|
|
7894
8155
|
}
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
return;
|
|
7898
|
-
case PROCESSING_INSTRUCTION_NODE:
|
|
7899
|
-
return buf.push( "<?",node.target," ",node.data,"?>");
|
|
7900
|
-
case ENTITY_REFERENCE_NODE:
|
|
7901
|
-
return buf.push( '&',node.nodeName,';');
|
|
7902
|
-
//case ENTITY_NODE:
|
|
7903
|
-
//case NOTATION_NODE:
|
|
7904
|
-
default:
|
|
7905
|
-
buf.push('??',node.nodeName);
|
|
7906
|
-
}
|
|
8156
|
+
},
|
|
8157
|
+
});
|
|
7907
8158
|
}
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
var child = node.firstChild;
|
|
7946
|
-
while(child){
|
|
7947
|
-
node2.appendChild(importNode(doc,child,deep));
|
|
7948
|
-
child = child.nextSibling;
|
|
7949
|
-
}
|
|
7950
|
-
}
|
|
7951
|
-
return node2;
|
|
8159
|
+
/**
|
|
8160
|
+
* Imports a node from a different document into `doc`, creating a new copy.
|
|
8161
|
+
* Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
|
|
8162
|
+
* stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
|
|
8163
|
+
* Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
|
|
8164
|
+
* always forced to `true`
|
|
8165
|
+
* because an attribute's value lives in a child text node.
|
|
8166
|
+
*
|
|
8167
|
+
* @param {Document} doc
|
|
8168
|
+
* The document that will own the imported node.
|
|
8169
|
+
* @param {Node} node
|
|
8170
|
+
* The node to import.
|
|
8171
|
+
* @param {boolean} deep
|
|
8172
|
+
* If `true`, descendants are imported recursively.
|
|
8173
|
+
* @returns {Node}
|
|
8174
|
+
* The newly imported node, now owned by `doc`.
|
|
8175
|
+
*/
|
|
8176
|
+
function importNode(doc, node, deep) {
|
|
8177
|
+
var destRoot;
|
|
8178
|
+
walkDOM(node, null, {
|
|
8179
|
+
enter: function (srcNode, destParent) {
|
|
8180
|
+
// Shallow-clone the node and stamp it into the target document.
|
|
8181
|
+
var destNode = srcNode.cloneNode(false);
|
|
8182
|
+
destNode.ownerDocument = doc;
|
|
8183
|
+
destNode.parentNode = null;
|
|
8184
|
+
// capture as the root of the imported subtree or attach to parent.
|
|
8185
|
+
if (destParent === null) {
|
|
8186
|
+
destRoot = destNode;
|
|
8187
|
+
} else {
|
|
8188
|
+
destParent.appendChild(destNode);
|
|
8189
|
+
}
|
|
8190
|
+
// ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
|
|
8191
|
+
var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
|
|
8192
|
+
return shouldDeep ? destNode : null;
|
|
8193
|
+
},
|
|
8194
|
+
});
|
|
8195
|
+
return destRoot;
|
|
7952
8196
|
}
|
|
7953
8197
|
//
|
|
7954
8198
|
//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
|
|
7955
8199
|
// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
|
|
7956
|
-
function cloneNode(doc,node,deep){
|
|
7957
|
-
var
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
8200
|
+
function cloneNode(doc, node, deep) {
|
|
8201
|
+
var destRoot;
|
|
8202
|
+
walkDOM(node, null, {
|
|
8203
|
+
enter: function (srcNode, destParent) {
|
|
8204
|
+
// 1. Create a blank node of the same type and copy all scalar own properties.
|
|
8205
|
+
var destNode = new srcNode.constructor();
|
|
8206
|
+
for (var n in srcNode) {
|
|
8207
|
+
if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
|
|
8208
|
+
var v = srcNode[n];
|
|
8209
|
+
if (typeof v != 'object') {
|
|
8210
|
+
if (v != destNode[n]) {
|
|
8211
|
+
destNode[n] = v;
|
|
8212
|
+
}
|
|
8213
|
+
}
|
|
7964
8214
|
}
|
|
7965
8215
|
}
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
8216
|
+
if (srcNode.childNodes) {
|
|
8217
|
+
destNode.childNodes = new NodeList();
|
|
8218
|
+
}
|
|
8219
|
+
destNode.ownerDocument = doc;
|
|
8220
|
+
// 2. Handle node-type-specific setup.
|
|
8221
|
+
// Attributes are not DOM children, so they are cloned inline here
|
|
8222
|
+
// rather than by walkDOM descent.
|
|
8223
|
+
// ATTRIBUTE_NODE forces deep=true so its own children are walked.
|
|
8224
|
+
var shouldDeep = deep;
|
|
8225
|
+
switch (destNode.nodeType) {
|
|
8226
|
+
case ELEMENT_NODE:
|
|
8227
|
+
var attrs = srcNode.attributes;
|
|
8228
|
+
var attrs2 = (destNode.attributes = new NamedNodeMap());
|
|
8229
|
+
var len = attrs.length;
|
|
8230
|
+
attrs2._ownerElement = destNode;
|
|
8231
|
+
for (var i = 0; i < len; i++) {
|
|
8232
|
+
destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
|
|
8233
|
+
}
|
|
8234
|
+
break;
|
|
8235
|
+
case ATTRIBUTE_NODE:
|
|
8236
|
+
shouldDeep = true;
|
|
8237
|
+
}
|
|
8238
|
+
// 3. Attach to parent, or capture as the root of the cloned subtree.
|
|
8239
|
+
if (destParent !== null) {
|
|
8240
|
+
destParent.appendChild(destNode);
|
|
8241
|
+
} else {
|
|
8242
|
+
destRoot = destNode;
|
|
8243
|
+
}
|
|
8244
|
+
// 4. Return destNode as the context for children (causes walkDOM to descend),
|
|
8245
|
+
// or null to skip children (shallow clone).
|
|
8246
|
+
return shouldDeep ? destNode : null;
|
|
8247
|
+
},
|
|
8248
|
+
});
|
|
8249
|
+
return destRoot;
|
|
7992
8250
|
}
|
|
7993
8251
|
|
|
7994
8252
|
function __set__(object,key,value){
|
|
@@ -8004,49 +8262,55 @@ function requireDom () {
|
|
|
8004
8262
|
}
|
|
8005
8263
|
});
|
|
8006
8264
|
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8265
|
+
/**
|
|
8266
|
+
* The text content of this node and its descendants.
|
|
8267
|
+
*
|
|
8268
|
+
* Setting `textContent` on an element or document fragment replaces all child nodes with a
|
|
8269
|
+
* single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
|
|
8270
|
+
*
|
|
8271
|
+
* @type {string | null}
|
|
8272
|
+
* @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
|
|
8273
|
+
*/
|
|
8274
|
+
Object.defineProperty(Node.prototype, 'textContent', {
|
|
8275
|
+
get: function () {
|
|
8276
|
+
if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
|
8277
|
+
var buf = [];
|
|
8278
|
+
walkDOM(this, null, {
|
|
8279
|
+
enter: function (n) {
|
|
8280
|
+
if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
|
8281
|
+
return true; // enter children
|
|
8282
|
+
}
|
|
8283
|
+
if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
|
|
8284
|
+
return null; // excluded from text content
|
|
8285
|
+
}
|
|
8286
|
+
buf.push(n.nodeValue);
|
|
8287
|
+
},
|
|
8288
|
+
});
|
|
8289
|
+
return buf.join('');
|
|
8290
|
+
}
|
|
8291
|
+
return this.nodeValue;
|
|
8010
8292
|
},
|
|
8011
8293
|
|
|
8012
|
-
set:function(data){
|
|
8013
|
-
switch(this.nodeType){
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8294
|
+
set: function (data) {
|
|
8295
|
+
switch (this.nodeType) {
|
|
8296
|
+
case ELEMENT_NODE:
|
|
8297
|
+
case DOCUMENT_FRAGMENT_NODE:
|
|
8298
|
+
while (this.firstChild) {
|
|
8299
|
+
this.removeChild(this.firstChild);
|
|
8300
|
+
}
|
|
8301
|
+
if (data || String(data)) {
|
|
8302
|
+
this.appendChild(this.ownerDocument.createTextNode(data));
|
|
8303
|
+
}
|
|
8304
|
+
break;
|
|
8023
8305
|
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8306
|
+
default:
|
|
8307
|
+
this.data = data;
|
|
8308
|
+
this.value = data;
|
|
8309
|
+
this.nodeValue = data;
|
|
8028
8310
|
}
|
|
8029
|
-
}
|
|
8311
|
+
},
|
|
8030
8312
|
});
|
|
8031
8313
|
|
|
8032
|
-
function getTextContent(node){
|
|
8033
|
-
switch(node.nodeType){
|
|
8034
|
-
case ELEMENT_NODE:
|
|
8035
|
-
case DOCUMENT_FRAGMENT_NODE:
|
|
8036
|
-
var buf = [];
|
|
8037
|
-
node = node.firstChild;
|
|
8038
|
-
while(node){
|
|
8039
|
-
if(node.nodeType!==7 && node.nodeType !==8){
|
|
8040
|
-
buf.push(getTextContent(node));
|
|
8041
|
-
}
|
|
8042
|
-
node = node.nextSibling;
|
|
8043
|
-
}
|
|
8044
|
-
return buf.join('');
|
|
8045
|
-
default:
|
|
8046
|
-
return node.nodeValue;
|
|
8047
|
-
}
|
|
8048
|
-
}
|
|
8049
|
-
|
|
8050
8314
|
__set__ = function(object,key,value){
|
|
8051
8315
|
//console.log(value)
|
|
8052
8316
|
object['$$'+key] = value;
|
|
@@ -8062,6 +8326,7 @@ function requireDom () {
|
|
|
8062
8326
|
dom.Element = Element;
|
|
8063
8327
|
dom.Node = Node;
|
|
8064
8328
|
dom.NodeList = NodeList;
|
|
8329
|
+
dom.walkDOM = walkDOM;
|
|
8065
8330
|
dom.XMLSerializer = XMLSerializer;
|
|
8066
8331
|
//}
|
|
8067
8332
|
return dom;
|
|
@@ -8076,7 +8341,7 @@ var hasRequiredEntities;
|
|
|
8076
8341
|
function requireEntities () {
|
|
8077
8342
|
if (hasRequiredEntities) return entities;
|
|
8078
8343
|
hasRequiredEntities = 1;
|
|
8079
|
-
(function (exports
|
|
8344
|
+
(function (exports) {
|
|
8080
8345
|
|
|
8081
8346
|
var freeze = requireConventions().freeze;
|
|
8082
8347
|
|
|
@@ -8087,7 +8352,7 @@ function requireEntities () {
|
|
|
8087
8352
|
* @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
|
|
8088
8353
|
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
|
|
8089
8354
|
*/
|
|
8090
|
-
exports
|
|
8355
|
+
exports.XML_ENTITIES = freeze({
|
|
8091
8356
|
amp: '&',
|
|
8092
8357
|
apos: "'",
|
|
8093
8358
|
gt: '>',
|
|
@@ -8109,7 +8374,7 @@ function requireEntities () {
|
|
|
8109
8374
|
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
|
|
8110
8375
|
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
|
|
8111
8376
|
*/
|
|
8112
|
-
exports
|
|
8377
|
+
exports.HTML_ENTITIES = freeze({
|
|
8113
8378
|
Aacute: '\u00C1',
|
|
8114
8379
|
aacute: '\u00E1',
|
|
8115
8380
|
Abreve: '\u0102',
|
|
@@ -10241,7 +10506,7 @@ function requireEntities () {
|
|
|
10241
10506
|
* @deprecated use `HTML_ENTITIES` instead
|
|
10242
10507
|
* @see HTML_ENTITIES
|
|
10243
10508
|
*/
|
|
10244
|
-
exports
|
|
10509
|
+
exports.entityMap = exports.HTML_ENTITIES;
|
|
10245
10510
|
} (entities));
|
|
10246
10511
|
return entities;
|
|
10247
10512
|
}
|
|
@@ -10852,7 +11117,7 @@ function requireSax () {
|
|
|
10852
11117
|
function parseInstruction(source,start,domBuilder){
|
|
10853
11118
|
var end = source.indexOf('?>',start);
|
|
10854
11119
|
if(end){
|
|
10855
|
-
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)
|
|
11120
|
+
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
|
|
10856
11121
|
if(match){
|
|
10857
11122
|
match[0].length;
|
|
10858
11123
|
domBuilder.processingInstruction(match[1], match[2]) ;
|
|
@@ -70046,14 +70311,80 @@ if (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) {
|
|
|
70046
70311
|
videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError);
|
|
70047
70312
|
}
|
|
70048
70313
|
|
|
70314
|
+
const ARIA_IDREF_ATTRIBUTES = new Map([
|
|
70315
|
+
['aria-activedescendant', 'ariaActivedescendantElement'],
|
|
70316
|
+
['aria-controls', 'ariaControlsElements'],
|
|
70317
|
+
['aria-describedby', 'ariaDescribedByElements'],
|
|
70318
|
+
['aria-details', 'ariaDetailsElements'],
|
|
70319
|
+
['aria-errormessage', 'ariaErrormessageElements'],
|
|
70320
|
+
['aria-flowto', 'ariaFlowtoElements'],
|
|
70321
|
+
['aria-labelledby', 'ariaLabelledByElements'],
|
|
70322
|
+
['aria-owns', 'ariaOwnsElements'],
|
|
70323
|
+
]);
|
|
70324
|
+
function resolveAriaIdRefs(element, value) {
|
|
70325
|
+
const ids = value
|
|
70326
|
+
.trim()
|
|
70327
|
+
.split(/\s+/)
|
|
70328
|
+
.filter((id) => id.length > 0);
|
|
70329
|
+
if (ids.length === 0)
|
|
70330
|
+
return null;
|
|
70331
|
+
const root = element.getRootNode();
|
|
70332
|
+
let resolvedElements = [];
|
|
70333
|
+
if (root instanceof ShadowRoot) {
|
|
70334
|
+
resolvedElements = ids.map((id) => root.getElementById(id));
|
|
70335
|
+
}
|
|
70336
|
+
else if (root instanceof Document) {
|
|
70337
|
+
resolvedElements = ids.map((id) => root.getElementById(id));
|
|
70338
|
+
}
|
|
70339
|
+
else {
|
|
70340
|
+
resolvedElements = ids.map((id) => document.getElementById(id));
|
|
70341
|
+
}
|
|
70342
|
+
if (resolvedElements.filter((el) => el !== null).length === 0) {
|
|
70343
|
+
resolvedElements = ids.map((id) => document.getElementById(id));
|
|
70344
|
+
}
|
|
70345
|
+
const validElements = resolvedElements.filter((el) => el !== null);
|
|
70346
|
+
return validElements.length === ids.length ? validElements : null;
|
|
70347
|
+
}
|
|
70348
|
+
function setInternalsProperty(el, name, resolvedElements) {
|
|
70349
|
+
if (name === 'aria-activedescendant') {
|
|
70350
|
+
const [firstElement] = resolvedElements;
|
|
70351
|
+
// eslint-disable-next-line no-param-reassign
|
|
70352
|
+
el[name] = firstElement;
|
|
70353
|
+
}
|
|
70354
|
+
else {
|
|
70355
|
+
// eslint-disable-next-line no-param-reassign
|
|
70356
|
+
el[name] = resolvedElements;
|
|
70357
|
+
}
|
|
70358
|
+
}
|
|
70049
70359
|
class SetAttributesDirective extends Directive {
|
|
70050
70360
|
update(part, [attributes]) {
|
|
70051
70361
|
const el = part.element;
|
|
70362
|
+
const internals = el.internals ?? null;
|
|
70052
70363
|
for (const [name, value] of Object.entries(attributes)) {
|
|
70053
|
-
if (value
|
|
70054
|
-
el.setAttribute(name, value);
|
|
70055
|
-
else
|
|
70364
|
+
if (value == null) {
|
|
70056
70365
|
el.removeAttribute(name);
|
|
70366
|
+
}
|
|
70367
|
+
else {
|
|
70368
|
+
const internalsPropertyName = ARIA_IDREF_ATTRIBUTES.get(name);
|
|
70369
|
+
if (internalsPropertyName) {
|
|
70370
|
+
const resolvedElements = resolveAriaIdRefs(el, String(value));
|
|
70371
|
+
if (resolvedElements) {
|
|
70372
|
+
if (internals) {
|
|
70373
|
+
// Set on ElementInternals
|
|
70374
|
+
setInternalsProperty(internals, internalsPropertyName, resolvedElements);
|
|
70375
|
+
}
|
|
70376
|
+
else {
|
|
70377
|
+
// Set internals property on shadowdom item
|
|
70378
|
+
el.setAttribute(name, String(value));
|
|
70379
|
+
setInternalsProperty(el, internalsPropertyName, resolvedElements);
|
|
70380
|
+
}
|
|
70381
|
+
}
|
|
70382
|
+
}
|
|
70383
|
+
else {
|
|
70384
|
+
// Non-ARIA IDREF attributes: set normally
|
|
70385
|
+
el.setAttribute(name, String(value));
|
|
70386
|
+
}
|
|
70387
|
+
}
|
|
70057
70388
|
}
|
|
70058
70389
|
return null;
|
|
70059
70390
|
}
|
|
@@ -70421,6 +70752,26 @@ class BaseComponent extends LitElement {
|
|
|
70421
70752
|
// generate internal _id
|
|
70422
70753
|
const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();
|
|
70423
70754
|
this._id = this.generateId(prefix);
|
|
70755
|
+
this.ariaAttributesObserver = new MutationObserver((mutations) => {
|
|
70756
|
+
const shouldUpdate = mutations.some((mutation) => {
|
|
70757
|
+
if (mutation.type !== 'attributes' || !mutation.attributeName) {
|
|
70758
|
+
return false;
|
|
70759
|
+
}
|
|
70760
|
+
return mutation.attributeName === 'it-role' || mutation.attributeName.startsWith('it-aria-');
|
|
70761
|
+
});
|
|
70762
|
+
if (shouldUpdate) {
|
|
70763
|
+
this.requestUpdate();
|
|
70764
|
+
}
|
|
70765
|
+
});
|
|
70766
|
+
this.ariaAttributesObserver.observe(this, {
|
|
70767
|
+
attributes: true,
|
|
70768
|
+
attributeOldValue: true,
|
|
70769
|
+
});
|
|
70770
|
+
}
|
|
70771
|
+
disconnectedCallback() {
|
|
70772
|
+
this.ariaAttributesObserver?.disconnect();
|
|
70773
|
+
this.ariaAttributesObserver = undefined;
|
|
70774
|
+
super.disconnectedCallback();
|
|
70424
70775
|
}
|
|
70425
70776
|
}
|
|
70426
70777
|
const BaseLocalizedComponent = LocalizeMixin(BaseComponent);
|
|
@@ -70853,7 +71204,7 @@ class FormControl extends BaseLocalizedComponent {
|
|
|
70853
71204
|
});
|
|
70854
71205
|
// TODO: verificare se serve davvero con il fatto che usiamo form-controller
|
|
70855
71206
|
// static formAssociated = true;
|
|
70856
|
-
//
|
|
71207
|
+
// @property()
|
|
70857
71208
|
// internals = this.attachInternals();
|
|
70858
71209
|
this._touched = false;
|
|
70859
71210
|
/** The name of the input, submitted as a name/value pair with form data. */
|
|
@@ -71131,7 +71482,7 @@ if (typeof window !== 'undefined') {
|
|
|
71131
71482
|
window._itAnalytics = window._itAnalytics || {};
|
|
71132
71483
|
window._itAnalytics = {
|
|
71133
71484
|
...window._itAnalytics,
|
|
71134
|
-
version: '1.0.0-alpha.
|
|
71485
|
+
version: '1.0.0-alpha.18',
|
|
71135
71486
|
};
|
|
71136
71487
|
}
|
|
71137
71488
|
|