aboutsummaryrefslogtreecommitdiff
path: root/node_modules/postcss-selector-parser/dist/selectors/node.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/postcss-selector-parser/dist/selectors/node.js
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/postcss-selector-parser/dist/selectors/node.js')
-rw-r--r--node_modules/postcss-selector-parser/dist/selectors/node.js102
1 files changed, 102 insertions, 0 deletions
diff --git a/node_modules/postcss-selector-parser/dist/selectors/node.js b/node_modules/postcss-selector-parser/dist/selectors/node.js
new file mode 100644
index 00000000..30f45fd4
--- /dev/null
+++ b/node_modules/postcss-selector-parser/dist/selectors/node.js
@@ -0,0 +1,102 @@
+'use strict';
+
+exports.__esModule = true;
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var cloneNode = function cloneNode(obj, parent) {
+ if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') {
+ return obj;
+ }
+
+ var cloned = new obj.constructor();
+
+ for (var i in obj) {
+ if (!obj.hasOwnProperty(i)) {
+ continue;
+ }
+ var value = obj[i];
+ var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
+
+ if (i === 'parent' && type === 'object') {
+ if (parent) {
+ cloned[i] = parent;
+ }
+ } else if (value instanceof Array) {
+ cloned[i] = value.map(function (j) {
+ return cloneNode(j, cloned);
+ });
+ } else {
+ cloned[i] = cloneNode(value, cloned);
+ }
+ }
+
+ return cloned;
+};
+
+var _class = function () {
+ function _class() {
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ _classCallCheck(this, _class);
+
+ for (var key in opts) {
+ this[key] = opts[key];
+ }
+ var _opts$spaces = opts.spaces;
+ _opts$spaces = _opts$spaces === undefined ? {} : _opts$spaces;
+ var _opts$spaces$before = _opts$spaces.before,
+ before = _opts$spaces$before === undefined ? '' : _opts$spaces$before,
+ _opts$spaces$after = _opts$spaces.after,
+ after = _opts$spaces$after === undefined ? '' : _opts$spaces$after;
+
+ this.spaces = { before: before, after: after };
+ }
+
+ _class.prototype.remove = function remove() {
+ if (this.parent) {
+ this.parent.removeChild(this);
+ }
+ this.parent = undefined;
+ return this;
+ };
+
+ _class.prototype.replaceWith = function replaceWith() {
+ if (this.parent) {
+ for (var index in arguments) {
+ this.parent.insertBefore(this, arguments[index]);
+ }
+ this.remove();
+ }
+ return this;
+ };
+
+ _class.prototype.next = function next() {
+ return this.parent.at(this.parent.index(this) + 1);
+ };
+
+ _class.prototype.prev = function prev() {
+ return this.parent.at(this.parent.index(this) - 1);
+ };
+
+ _class.prototype.clone = function clone() {
+ var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ var cloned = cloneNode(this);
+ for (var name in overrides) {
+ cloned[name] = overrides[name];
+ }
+ return cloned;
+ };
+
+ _class.prototype.toString = function toString() {
+ return [this.spaces.before, String(this.value), this.spaces.after].join('');
+ };
+
+ return _class;
+}();
+
+exports.default = _class;
+module.exports = exports['default']; \ No newline at end of file