Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/cheerio-select/node_modules/CSSselect/node_modules/domutils/lib/helpers.js

Issue 125733002: Add vulcanize to tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/cheerio-select/node_modules/CSSselect/node_modules/domutils/lib/helpers.js
diff --git a/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/cheerio-select/node_modules/CSSselect/node_modules/domutils/lib/helpers.js b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/cheerio-select/node_modules/CSSselect/node_modules/domutils/lib/helpers.js
new file mode 100644
index 0000000000000000000000000000000000000000..476b8eb51b67247c802ad3a77d18ab4266bbb3b7
--- /dev/null
+++ b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/cheerio-select/node_modules/CSSselect/node_modules/domutils/lib/helpers.js
@@ -0,0 +1,31 @@
+// removeSubsets
+// Given an array of nodes, remove any member that is contained by another.
+exports.removeSubsets = function(nodes) {
+ var idx = nodes.length, node, ancestor, replace;
+
+ // Check if each node (or one of its ancestors) is already contained in the
+ // array.
+ while (--idx > -1) {
+ node = ancestor = nodes[idx];
+
+ // Temporarily remove the node under consideration
+ nodes[idx] = null;
+ replace = true;
+
+ while (ancestor) {
+ if (nodes.indexOf(ancestor) > -1) {
+ replace = false;
+ nodes.splice(idx, 1);
+ break;
+ }
+ ancestor = ancestor.parent;
+ }
+
+ // If the node has been found to be unique, re-insert it.
+ if (replace) {
+ nodes[idx] = node;
+ }
+ }
+
+ return nodes;
+};

Powered by Google App Engine
This is Rietveld 408576698