@olton/query
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -14,4 +14,2 @@ "use strict"; | ||
var _content = _interopRequireDefault(require("./content")); | ||
var _class = _interopRequireDefault(require("./class")); | ||
@@ -196,4 +194,4 @@ | ||
Query.use(_attr["default"], _prop["default"], _content["default"], _class["default"], _style["default"], _size["default"], _position["default"], _visibility["default"], _manipulation["default"], _contains["default"], _events["default"], _data["default"]); | ||
Query.use(_attr["default"], _prop["default"], _class["default"], _style["default"], _size["default"], _position["default"], _visibility["default"], _manipulation["default"], _contains["default"], _events["default"], _data["default"]); | ||
var _default = Query; | ||
exports["default"] = _default; |
@@ -8,2 +8,4 @@ "use strict"; | ||
var _jsUtils = require("@olton/js-utils"); | ||
var _dollar = _interopRequireDefault(require("../dollar")); | ||
@@ -23,3 +25,3 @@ | ||
var el = this; | ||
el[prop] = value; | ||
if (typeof el[prop] !== "undefined") el[prop] = value; | ||
@@ -33,2 +35,54 @@ if (prop === "innerHTML") { | ||
return arguments.length === 1 ? this._prop(_prop2) : this._prop(_prop2, typeof value === "undefined" ? "" : value); | ||
}, | ||
val: function val(value) { | ||
if (value === undefined || value === null) { | ||
return this.length === 0 ? undefined : this[0].value; | ||
} | ||
return this.each(function () { | ||
var el = this; | ||
if (typeof el.value !== "undefined") { | ||
el.value = value; | ||
} else { | ||
el.innerHTML = value; | ||
} | ||
}); | ||
}, | ||
html: function html(value) { | ||
var that = this, | ||
v = []; | ||
if (arguments.length === 0) { | ||
return this._prop('innerHTML'); | ||
} | ||
if ((0, _jsUtils.isArrayLike)(value)) { | ||
(0, _jsUtils.each)(value, function () { | ||
if (this instanceof HTMLElement) v.push(this.outerHTML); | ||
}); | ||
} else { | ||
v.push(value); | ||
} | ||
that._prop('innerHTML', v.join("\n")); | ||
return this; | ||
}, | ||
outerHTML: function outerHTML() { | ||
return this._prop('outerHTML'); | ||
}, | ||
text: function text(value) { | ||
return arguments.length === 0 ? this._prop('textContent') : this._prop('textContent', typeof value === "undefined" ? "" : value); | ||
}, | ||
innerText: function innerText(value) { | ||
return arguments.length === 0 ? this._prop('innerText') : this._prop('innerText', typeof value === "undefined" ? "" : value); | ||
}, | ||
empty: function empty() { | ||
return this.each(function () { | ||
if (typeof this.innerHTML !== "undefined") this.innerHTML = ""; | ||
}); | ||
}, | ||
clear: function clear() { | ||
return this.empty(); | ||
} | ||
@@ -35,0 +89,0 @@ }; |
{ | ||
"name": "@olton/query", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Javascript class for DOM manipulation and querying", | ||
@@ -29,5 +29,5 @@ "main": "index.js", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.8.6", | ||
"@babel/node": "^7.8.4", | ||
"@babel/preset-env": "^7.8.6", | ||
"@babel/core": "^7.8.7", | ||
"@babel/node": "^7.8.7", | ||
"@babel/preset-env": "^7.8.7", | ||
"babel-jest": "^25.1.0", | ||
@@ -37,3 +37,3 @@ "babel-loader": "^8.0.6", | ||
"copy-webpack-plugin": "^5.1.1", | ||
"cross-env": "^7.0.0", | ||
"cross-env": "^7.0.2", | ||
"file-loader": "^5.1.0", | ||
@@ -51,4 +51,4 @@ "html-webpack-plugin": "^3.2.0", | ||
"dependencies": { | ||
"@olton/js-utils": "^0.11.6" | ||
"@olton/js-utils": "^0.28.0" | ||
} | ||
} |
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
68715
1940
+ Added@olton/js-utils@0.28.0(transitive)
- Removed@olton/js-utils@0.11.6(transitive)
Updated@olton/js-utils@^0.28.0