Comparing version 2.3.5 to 2.3.6
@@ -969,2 +969,15 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
}); | ||
}; // @require core/cash.js | ||
fn.empty = function () { | ||
var ele = this[0]; | ||
if (ele) { | ||
while (ele.firstChild) { | ||
ele.removeChild(ele.firstChild); | ||
} | ||
} | ||
return this; | ||
}; | ||
@@ -1027,8 +1040,2 @@ | ||
}; // @require core/cash.js | ||
// @require ./html.js | ||
fn.empty = function () { | ||
return this.html(''); | ||
}; // @require core/cash.js | ||
// @require collection/each.js | ||
@@ -1035,0 +1042,0 @@ |
@@ -980,2 +980,15 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
}); | ||
}; // @require core/cash.js | ||
fn.empty = function () { | ||
var ele = this[0]; | ||
if (ele) { | ||
while (ele.firstChild) { | ||
ele.removeChild(ele.firstChild); | ||
} | ||
} | ||
return this; | ||
}; | ||
@@ -1038,8 +1051,2 @@ | ||
}; // @require core/cash.js | ||
// @require ./html.js | ||
fn.empty = function () { | ||
return this.html(''); | ||
}; // @require core/cash.js | ||
// @require collection/each.js | ||
@@ -1046,0 +1053,0 @@ |
@@ -25,5 +25,5 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
y.serialize=function(){var a="";this.each(function(b,c){A(c.elements||[c],function(b){if(!b.disabled&&b.name&&"FIELDSET"!==b.tagName&&!ua.test(b.type)&&(!va.test(b.type)||b.checked)){var c=X(b);void 0!==c&&(c=E(c)?c:[c],A(c,function(c){var d=a;c="&"+encodeURIComponent(b.name)+"="+encodeURIComponent(c).replace(ta,"+");a=d+c}))}})});return a.substr(1)}; | ||
y.val=function(a){return void 0===a?this[0]&&X(this[0]):this.each(function(b,c){W.test(c.type)&&E(a)?A(c.options,function(b){b.selected=0<=a.indexOf(b.value)}):c.value=a})};y.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};y.detach=function(){return this.each(function(a,b){b.parentNode&&b.parentNode.removeChild(b)})}; | ||
y.val=function(a){return void 0===a?this[0]&&X(this[0]):this.each(function(b,c){W.test(c.type)&&E(a)?A(c.options,function(b){b.selected=0<=a.indexOf(b.value)}):c.value=a})};y.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};y.detach=function(){return this.each(function(a,b){b.parentNode&&b.parentNode.removeChild(b)})};y.empty=function(){var a=this[0];if(a)for(;a.firstChild;)a.removeChild(a.firstChild);return this}; | ||
function Y(a,b,c){var d=u(b);!d&&b.length?A(b,function(b){return Y(a,b,c)}):A(a,d?function(a){a.insertAdjacentHTML(c?"afterbegin":"beforeend",b)}:function(a,d){d=d?b.cloneNode(!0):b;c?a.insertBefore(d,a.childNodes[0]):a.appendChild(d)})}y.append=function(){var a=this;A(arguments,function(b){Y(a,b)});return this};y.appendTo=function(a){Y(x(a),this);return this}; | ||
y.html=function(a){if(void 0===a)return this[0]&&this[0].innerHTML;var b=a.nodeType?a[0].outerHTML:a;return this.each(function(a,d){d.innerHTML=b})};y.empty=function(){return this.html("")};y.insertAfter=function(a){var b=this;x(a).each(function(a,d){var c=d.parentNode;b.each(function(b,f){c.insertBefore(a?f.cloneNode(!0):f,d.nextSibling)})});return this};y.after=function(){var a=this;A(n.apply(arguments),function(b){n.apply(x(b).slice()).insertAfter(a)});return this}; | ||
y.html=function(a){if(void 0===a)return this[0]&&this[0].innerHTML;var b=a.nodeType?a[0].outerHTML:a;return this.each(function(a,d){d.innerHTML=b})};y.insertAfter=function(a){var b=this;x(a).each(function(a,d){var c=d.parentNode;b.each(function(b,f){c.insertBefore(a?f.cloneNode(!0):f,d.nextSibling)})});return this};y.after=function(){var a=this;A(n.apply(arguments),function(b){n.apply(x(b).slice()).insertAfter(a)});return this}; | ||
y.insertBefore=function(a){var b=this;x(a).each(function(a,d){var c=d.parentNode;b.each(function(b,f){c.insertBefore(a?f.cloneNode(!0):f,d)})});return this};y.before=function(){var a=this;A(arguments,function(b){x(b).insertBefore(a)});return this};y.prepend=function(){var a=this;A(arguments,function(b){Y(a,b,!0)});return this};y.prependTo=function(a){Y(x(a),n.apply(this.slice()),!0);return this};y.remove=function(){return this.detach().off()}; | ||
@@ -30,0 +30,0 @@ y.replaceWith=function(a){var b=this;return this.each(function(c,d){var f=d.parentNode;if(f){c=c?x(a).clone():x(a);if(!c[0])return b.remove(),!1;f.replaceChild(c[0],d);x(c[0]).after(c.slice(1))}})};y.replaceAll=function(a){x(a).replaceWith(this);return this};y.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){c.textContent=a})};var Z=e.documentElement; |
{ | ||
"name": "cash-dom", | ||
"description": "An absurdly small jQuery alternative for modern browsers.", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"license": "MIT", | ||
@@ -21,2 +21,3 @@ "main": "./dist/cash.js", | ||
"test:watch": "browser-sync start -s . --files test,dist/cash.js --startPath test --no-notify", | ||
"test:karma": "karma start", | ||
"test:jquery": "( git -C ./test/jquery pull || git clone https://github.com/jquery/jquery.git ./test/jquery ) && npm run test:jquery:build && cd ./test/jquery && opn http://localhost:4444/test/index.html\\?module=css && php -S localhost:4444", | ||
@@ -40,5 +41,10 @@ "test:jquery:build": "cat ./node_modules/jquery/dist/jquery.js ./dist/cash.js ./test/jquery_patch.js > ./test/jquery/dist/jquery.min.js", | ||
"jquery": "^3.3.1", | ||
"karma": "^3.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-qunit": "^2.1.0", | ||
"karma-spec-reporter": "0.0.32", | ||
"opn-cli": "^3.1.0", | ||
"pacco": "^1.3.4" | ||
"pacco": "^1.3.4", | ||
"qunit": "^2.6.2" | ||
} | ||
} |
@@ -34,3 +34,3 @@ | ||
Cash is also available through [NPM](http://npmjs.com) as the [`cash-dom`](https://www.npmjs.com/package/cash-dom) package: | ||
Cash is also available through [npm](http://npmjs.com) as the [`cash-dom`](https://www.npmjs.com/package/cash-dom) package: | ||
@@ -845,1 +845,10 @@ ```sh | ||
``` | ||
## Thanks | ||
- **[@hisk](https://github.com/hisk)** - The "design focused engineer" behind our awesome logo. | ||
- **[Sauce Labs](https://saucelabs.com)** - The cross-browser testing platform we use for testing our builds in all the supported environments. | ||
## License | ||
MIT © Ken Wheeler |
// @require core/cash.js | ||
// @require ./html.js | ||
fn.empty = function () { | ||
return this.html ( '' ); | ||
const ele = this[0]; | ||
if ( ele ) { | ||
while ( ele.firstChild ) { | ||
ele.removeChild ( ele.firstChild ); | ||
} | ||
} | ||
return this; | ||
}; |
/* INIT */ | ||
QUnit.module( 'Cash Test Suite', { | ||
beforeEach: function () { | ||
document.getElementById ( 'qunit-fixture' ).innerHTML = ' \ | ||
<div class="class-fixture"></div> \ | ||
<fieldset class="tagname-fixture"></fieldset> \ | ||
<div id="id-fixture"></div> \ | ||
<div class="qsa-fixture"></div> \ | ||
<div class="qsa-fixture"></div> \ | ||
<div class="attr-fixture has-class-two has-class has-class-three" data-index="5" data-index-other="100" success="get"></div> \ | ||
<div class="attr-fixture2 has-class-two has-class-three" data-index="6" success="get"></div> \ | ||
<span class="css-fixture" style="display: block; height: 50px; width: 50px; padding: 20px; margin: 20px; border: 5px solid black;"></span> \ | ||
<input type="checkbox" class="prop-fixture" checked/> \ | ||
<a class="event-fixture">Click Me</a> \ | ||
<a class="trigger-fixture">Click Me</a> \ | ||
<a class="trigger-data-fixture">Click Me</a> \ | ||
<a class="delegate-fixture"><span class="delegate-trigger">Click Me</span></a> \ | ||
<a class="off-fixture">Click Me</a> \ | ||
<form class="form-fixture" name="form-fixture"> \ | ||
<input type="hidden" value="5" name="hidden"/> \ | ||
<input type="text" value="text" name="text"/> \ | ||
<input type="text" value="I\'m disabled" name="disabled-check" disabled /> \ | ||
<input type="checkbox" value="yes" checked="checked" name="checkbox-yes" /> \ | ||
<input type="checkbox" value="no" name="checkbox-no" /> \ | ||
<input type="radio" value="yes" checked="checked" name="radio" /> \ | ||
<input type="radio" value="no" name="radio" /> \ | ||
<select name="select"> \ | ||
<option value="not-selected">Not Selected</option> \ | ||
<option value="selected" selected>Selected</option> \ | ||
</select> \ | ||
<select name="select-multiple" multiple> \ | ||
<option value="option-1" selected>Selected</option> \ | ||
<option value="option-2" selected>Selected</option> \ | ||
</select> \ | ||
<input type="file" name="file" /> \ | ||
<input type="submit" value="submit" name="submit" /> \ | ||
</form> \ | ||
'; | ||
} | ||
}); | ||
/* CORE */ | ||
@@ -41,2 +83,3 @@ | ||
QUnit.test( "$(fn)", function( assert ) { | ||
var done = assert.async(); | ||
var called = false; | ||
@@ -48,7 +91,5 @@ var readyFn = function() { called = true; } | ||
stop(); | ||
setTimeout(function() { | ||
assert.equal(called, true); | ||
start(); | ||
done(); | ||
}, 10); | ||
@@ -501,3 +542,3 @@ }); | ||
QUnit.test( "serialize control elements", function( assert ) { | ||
var data = $('input[type=text]').serialize(); | ||
var data = $('#qunit-fixture input[type=text]').serialize(); | ||
assert.equal(data, "text=text", "serialize elemnts passed!" ); | ||
@@ -507,5 +548,5 @@ }); | ||
QUnit.test( "val", function( assert ) { | ||
assert.equal($('input[type=text]').val(), "text", "val get Passed!" ); | ||
$('input[type=text]').val(0); | ||
assert.equal($('input[type=text]').val(), 0, "val set Passed!" ); | ||
assert.equal($('#qunit-fixture input[type=text]').val(), "text", "val get Passed!" ); | ||
$('#qunit-fixture input[type=text]').val(0); | ||
assert.equal($('#qunit-fixture input[type=text]').val(), 0, "val set Passed!" ); | ||
assert.equal($('select[name=select]').val(), "selected", "val get select Passed!" ); | ||
@@ -515,5 +556,5 @@ $('select[name=select]').val('not-selected'); | ||
assert.deepEqual($('select[name=select-multiple]').val(), ['option-1', 'option-2'], "val get select multiple Passed!" ); | ||
$('input[type=text]').val(null); | ||
$('#qunit-fixture input[type=text]').val(null); | ||
$('select[name=select-multiple]').val(null); | ||
assert.deepEqual($('input[type=text]').val(), '', "val set to null Passed!" ); | ||
assert.deepEqual($('#qunit-fixture input[type=text]').val(), '', "val set to null Passed!" ); | ||
assert.deepEqual($('select[name=select-multiple]').val(), [], "val set to null Passed!" ); | ||
@@ -671,2 +712,3 @@ $('select[name=select-multiple]').val(['option-1']); | ||
QUnit.test( "offsetParent", function( assert ) { | ||
$('#qunit-fixture').css('position', 'relative'); // An element is said to be positioned if it has a CSS position attribute of relative, absolute, or fixed | ||
assert.equal($('.class-fixture').offsetParent ()[0], $('#qunit-fixture')[0], "offsetParent Passed!" ); | ||
@@ -801,3 +843,3 @@ }); | ||
QUnit.test( "$.parseHTML", function( assert ) { | ||
assert.equal($.parseHTML('<a>')[0].outerHTML, '<a></a>' , "$.parseHTML Passed!" ); | ||
assert.equal($.parseHTML('<a></a>')[0].outerHTML, '<a></a>' , "$.parseHTML Passed!" ); | ||
}); | ||
@@ -804,0 +846,0 @@ |
Sorry, the diff of this file is not supported yet
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
617346
134
4354
853
9