Comparing version 4.4.5 to 5.0.0
@@ -17,3 +17,3 @@ // Module core/highlight | ||
var swapStyleOwner = utils.makeOwnerSwapper(codeStyle); | ||
swapStyleOwner(document, document.head); | ||
swapStyleOwner(document.head); | ||
return { | ||
@@ -27,3 +27,3 @@ run: function(conf, doc, cb) { | ||
if (codeStyle.ownerDocument !== doc) { | ||
swapStyleOwner(doc, doc.head); | ||
swapStyleOwner(doc.head); | ||
} | ||
@@ -30,0 +30,0 @@ |
@@ -23,3 +23,3 @@ // Module core/style | ||
var swapStyleOwner = utils.makeOwnerSwapper(styleElement); | ||
swapStyleOwner(document, document.head); | ||
swapStyleOwner(document.head); | ||
return { | ||
@@ -30,3 +30,3 @@ run: function(conf, doc, cb) { | ||
} else if (styleElement.ownerDocument !== doc) { | ||
swapStyleOwner(doc, doc.head); | ||
swapStyleOwner(doc.head); | ||
} | ||
@@ -33,0 +33,0 @@ cb(); |
@@ -42,6 +42,6 @@ /*jshint browser: true */ | ||
* @param {Node} node The node to be swapped. | ||
* @return {Function} A function that takes a document and a new | ||
* insertion point (element). When called, | ||
* @return {Function} A function that takes a new | ||
* insertion point (Node). When called, | ||
* node gets inserted into doc at before a given | ||
* insertion point (node) - or just appended, if | ||
* insertion point (Node) - or just appended, if | ||
* the element has no children. | ||
@@ -51,36 +51,13 @@ */ | ||
if (!(node instanceof Node)) { | ||
throw TypeError(); | ||
throw new TypeError("Expected instance of Node."); | ||
} | ||
return function(doc, insertionPoint) { | ||
return function(insertionPoint) { | ||
node.remove(); | ||
doc.adoptNode(node); | ||
var firstElementChild = this.findFirstElementChild(insertionPoint); | ||
if (firstElementChild) { | ||
insertionPoint.insertBefore(node, firstElementChild); | ||
return; | ||
insertionPoint.ownerDocument.adoptNode(node); | ||
if (insertionPoint.firstElementChild) { | ||
return insertionPoint.insertBefore(node, insertionPoint.firstElementChild); | ||
} | ||
insertionPoint.appendChild(node); | ||
}.bind(this); | ||
}; | ||
}, | ||
/** | ||
* Finds the first Element child, given a node. Provides support for | ||
* Microsoft Edge's missing support of .firstElementChild. | ||
* | ||
* @param {Node} node The node to be traversed. | ||
* @return {Element} The first Element in the child list. | ||
*/ | ||
findFirstElementChild: function(node) { | ||
if (!node.hasChildNodes()) { | ||
return null; | ||
} | ||
// We have native support | ||
if (node.firstElementChild) { | ||
return node.firstElementChild; | ||
} | ||
return Array | ||
.from(node.childNodes) | ||
.find(function(node) { | ||
return node.nodeType === Node.ELEMENT_NODE; | ||
}); | ||
}, | ||
calculateLeftPad: function(text) { | ||
@@ -87,0 +64,0 @@ if (typeof text !== "string") { |
{ | ||
"name": "respec", | ||
"version": "4.4.5", | ||
"version": "5.0.0", | ||
"license": "W3C", | ||
@@ -5,0 +5,0 @@ "description": "A technical specification pre-processor.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
10
3768393
31595