update dependency after merge from master

This commit is contained in:
Slawomir Jaranowski
2022-10-15 13:37:56 +02:00
parent 620d2d6a7b
commit 002a281bd1
111 changed files with 4662 additions and 1015 deletions

View File

@ -22,6 +22,31 @@ function freeze(object, oc) {
return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
}
/**
* Since we can not rely on `Object.assign` we provide a simplified version
* that is sufficient for our needs.
*
* @param {Object} target
* @param {Object | null | undefined} source
*
* @returns {Object} target
* @throws TypeError if target is not an object
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
* @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
*/
function assign(target, source) {
if (target === null || typeof target !== 'object') {
throw new TypeError('target is not an object')
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
return target
}
/**
* All mime types that are allowed as input to `DOMParser.parseFromString`
*
@ -139,6 +164,7 @@ var NAMESPACE = freeze({
XMLNS: 'http://www.w3.org/2000/xmlns/',
})
exports.assign = assign;
exports.freeze = freeze;
exports.MIME_TYPE = MIME_TYPE;
exports.NAMESPACE = NAMESPACE;

View File

@ -62,7 +62,9 @@ function arrayIncludes (list) {
function copy(src,dest){
for(var p in src){
dest[p] = src[p];
if (Object.prototype.hasOwnProperty.call(src, p)) {
dest[p] = src[p];
}
}
}
@ -509,9 +511,9 @@ Node.prototype = {
//console.dir(map)
if(map){
for(var n in map){
if(map[n] == namespaceURI){
return n;
}
if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
return n;
}
}
}
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
@ -525,7 +527,7 @@ Node.prototype = {
var map = el._nsMap;
//console.dir(map)
if(map){
if(prefix in map){
if(Object.prototype.hasOwnProperty.call(map, prefix)){
return map[prefix] ;
}
}
@ -1187,9 +1189,10 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
* are serialized as their entity references, so they will be preserved.
* (In contrast to whitespace literals in the input which are normalized to spaces)
* @see https://www.w3.org/TR/xml11/#AVNormalize
* @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
*/
function addSerializedAttribute(buf, qualifiedName, value) {
buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
}
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
@ -1334,10 +1337,10 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
* and does not include the CDATA-section-close delimiter, `]]>`.
*
* @see https://www.w3.org/TR/xml/#NT-CharData
* @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
*/
return buf.push(node.data
.replace(/[<&]/g,_xmlEncoder)
.replace(/]]>/g, ']]&gt;')
.replace(/[<&>]/g,_xmlEncoder)
);
case CDATA_SECTION_NODE:
return buf.push( '<![CDATA[',node.data,']]>');
@ -1423,11 +1426,13 @@ function importNode(doc,node,deep){
// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
function cloneNode(doc,node,deep){
var node2 = new node.constructor();
for(var n in node){
var v = node[n];
if(typeof v != 'object' ){
if(v != node2[n]){
node2[n] = v;
for (var n in node) {
if (Object.prototype.hasOwnProperty.call(node, n)) {
var v = node[n];
if (typeof v != "object") {
if (v != node2[n]) {
node2[n] = v;
}
}
}
}

View File

@ -135,8 +135,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
if(endIgnoreCaseMach){
domBuilder.endElement(config.uri,config.localName,tagName);
if(localNSMap){
for(var prefix in localNSMap){
domBuilder.endPrefixMapping(prefix) ;
for (var prefix in localNSMap) {
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
domBuilder.endPrefixMapping(prefix);
}
}
}
if(!endMatch){
@ -478,8 +480,10 @@ function appendElement(el,domBuilder,currentNSMap){
if(el.closed){
domBuilder.endElement(ns,localName,tagName);
if(localNSMap){
for(prefix in localNSMap){
domBuilder.endPrefixMapping(prefix)
for (prefix in localNSMap) {
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
domBuilder.endPrefixMapping(prefix);
}
}
}
}else{
@ -525,9 +529,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
return pos<elStartEnd;
//}
}
function _copy(source,target){
for(var n in source){target[n] = source[n]}
function _copy (source, target) {
for (var n in source) {
if (Object.prototype.hasOwnProperty.call(source, n)) {
target[n] = source[n];
}
}
}
function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
var next= source.charAt(start+2)
switch(next){