diff --git a/README.md b/README.md index f5abb34..2206212 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ svelte What is svelte? --------------------- -It is a lightweight modern JavaScript library (4.34KB minified) intended for use on projects where legacy browser support is not necessary. +It is a lightweight modern JavaScript library (4.24KB minified) intended for use on projects where legacy browser support is not necessary. It uses mordern JavaScript (querySelectorAll, classList, matchesSelector) to help make it as lightweight as possible and therefore only works on the latest version of mordern browsers E.g. Chrome, Firefox, Opera, IE10+. diff --git a/gruntfile.js b/gruntfile.js index a1b63bc..e164028 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -19,7 +19,7 @@ module.exports = function(grunt) { dist : { options: { sourceMap: true, - banner: '/*** svelte - 1.2.0 ***/' + banner: '/*** svelte - 1.2.5 ***/' }, files: { 'svelte.min.js': ['svelte.js'], diff --git a/svelte.js b/svelte.js index 30396a3..836dc6c 100644 --- a/svelte.js +++ b/svelte.js @@ -1,14 +1,14 @@ /** * @fileOverview svelte - the lightweight modern DOM manipulation and events library * @author Matt Begent -* @version 1.2.0 +* @version 1.2.5 */ (function (window, document) { 'use strict'; -var svelte = { +var svelteProto = { /** * The dom ready function @@ -18,7 +18,7 @@ var svelte = { * @example * domready(function() { }); */ - domready: function(callback){ + domready: function(callback) { var readyState = document.readyState; if(readyState === 'complete' || readyState === 'loaded') { // if we are already go to go e.g. if using aync callback(); @@ -36,8 +36,8 @@ var svelte = { * $('.each').each(function() { }); */ each: function(callback) { - for (var i = 0; i < this.selector.length; i++) { - callback(this.selector[i]); + for (var i = 0, len = this.s.length; i < len; i++) { + callback(this.s[i]); } return this; }, @@ -51,7 +51,7 @@ var svelte = { * $('.parent').find('.child'); */ find: function(selector) { - return $(selector, this.selector[0]); + return svelte(selector, this.s[0]); }, /** @@ -69,7 +69,7 @@ var svelte = { el.style[property] = value; }); } else { - return getComputedStyle(this.selector[0])[property]; + return getComputedStyle(this.s[0])[property]; } }, @@ -107,7 +107,7 @@ var svelte = { * $('.visible').visible(); */ visible: function() { - return this.selector[0].offsetWidth > 0 || this.selector[0].offsetHeight > 0; + return this.s[0].offsetWidth > 0 || this.s[0].offsetHeight > 0; }, /** @@ -178,7 +178,11 @@ var svelte = { * $('.class').hasClass('another-class'); */ hasClass: function(className) { - return this.selector[0].classList.contains(className); + if(this.s.length > 0) { + return this.s[0].classList.contains(className); + } else { + return false; + } }, @@ -239,7 +243,7 @@ var svelte = { * $('.focus').focus(); */ focus: function() { - this.selector[0].focus(); + this.s[0].focus(); return this; }, @@ -317,7 +321,7 @@ var svelte = { * $('.selector').prev(); */ prev: function() { - this.selector = this.selector[0].previousElementSibling; + this.s = this.s[0].previousElementSibling; return this; }, @@ -329,7 +333,7 @@ var svelte = { * $('.selector').next(); */ next: function() { - this.selector = this.selector[0].nextElementSibling; + this.s = this.s[0].nextElementSibling; return this; }, @@ -341,7 +345,7 @@ var svelte = { * $('.selector').first(); */ first: function() { - this.selector = this.selector[0]; + this.s = this.s[0]; return this; }, @@ -353,8 +357,8 @@ var svelte = { * $('.selector').last(); */ last: function() { - var arrayLength = this.selector.length; - this.selector = this.selector.slice(arrayLength-1,arrayLength); + var arrayLength = this.s.length; + this.s = this.s.slice(arrayLength-1,arrayLength); return this; }, @@ -366,7 +370,7 @@ var svelte = { * $('.selector').parent(); */ parent: function() { - this.selector = this.selector[0].parentNode; + this.s = this.s[0].parentNode; return this; }, @@ -378,7 +382,7 @@ var svelte = { * $('.selector').children(); */ children: function() { - this.selector.slice.call(this.selector[0].children); + this.s.slice.call(this.s[0].children); return this; }, @@ -418,7 +422,7 @@ var svelte = { el.textContent = text; }); } else { - return this.selector[0].textContent.trim(); + return this.s[0].textContent.trim(); } }, @@ -436,7 +440,7 @@ var svelte = { el.innerHTML = html; }); } else { - return this.selector[0].innerHTML; + return this.s[0].innerHTML; } }, @@ -454,7 +458,7 @@ var svelte = { el.outerHTML = html; }); } else { - return this.selector[0].outerHTML; + return this.s[0].outerHTML; } }, @@ -509,7 +513,7 @@ var svelte = { */ attr: function(name, value) { if(!value) { - return this.selector[0].getAttribute(name); + return this.s[0].getAttribute(name); } else { return this.each(function(el) { el.setAttribute(name, value); @@ -539,7 +543,7 @@ var svelte = { * $('.input').val(); */ val: function() { - return this.selector[0].value; + return this.s[0].value; }, /** @@ -550,7 +554,7 @@ var svelte = { * $('.length').length(); */ length: function() { - return this.selector.length; + return this.s.length; }, /** @@ -561,7 +565,7 @@ var svelte = { * $('.height').height(); */ height: function() { - return this.selector[0].offsetHeight; + return this.s[0].offsetHeight; }, /** @@ -572,7 +576,7 @@ var svelte = { * $('.width').width(); */ width: function() { - return this.selector[0].offsetWidth; + return this.s[0].offsetWidth; }, /** @@ -583,7 +587,7 @@ var svelte = { * $('.position').position(); */ position: function() { - return this.selector[0].getBoundingClientRect(); + return this.s[0].getBoundingClientRect(); }, /** @@ -595,7 +599,7 @@ var svelte = { * $('.paragraph').matches('p'); */ matches: function(selector) { - var el = this.selector[0]; + var el = this.s[0]; // Tidy up Element.prototype.matches = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.webkitMatchesSelector; return el.matches(selector); @@ -604,13 +608,20 @@ var svelte = { }; /** @constructor svelte */ -function $(selector, context) { - return Object.create(svelte, { - selector: { +function svelte(selector, context) { + return Object.create(svelteProto, { + s: { get: function () { if(typeof selector === 'string') { var startAt = ((context === 'string') ? document.querySelectorAll(selector) : context) || document; // tidy up - return [].slice.call(startAt.querySelectorAll(selector)); + var nl = startAt.querySelectorAll(selector); + var arr = []; + + for (var i = 0, len = arr.length = nl.length; i < len; i++) { + arr[i] = nl[i]; + } + + return arr; } else { return [selector]; // could be an object, dom node or a function but always kept in an array } @@ -618,26 +629,17 @@ function $(selector, context) { set: function(value) { selector = value; } - }, - name: { - value: 'svelte' - }, - version: { - value: '1.2.0' } }); } // Expose svelte to the world:-) -window.$ = $; +window.$ = window.svelte = window.s = svelte; // Expose functions to the world -window.$.fn = window.$.svelte = svelte; +window.$.fn = svelteProto; // Shortcut to domready -window.domready = svelte.domready; - -// If using jQuery style -window.$.ready = svelte.domready; +window.domready = svelteProto.domready; }(window, document)); \ No newline at end of file diff --git a/svelte.min.js b/svelte.min.js index e8ee5ec..df2c429 100644 --- a/svelte.min.js +++ b/svelte.min.js @@ -1,3 +1,3 @@ -/*** svelte - 1.2.0 ***/ -!function(a,b){"use strict";function c(a,c){return Object.create(d,{selector:{get:function(){if("string"==typeof a){var d=("string"===c?b.querySelectorAll(a):c)||b;return[].slice.call(d.querySelectorAll(a))}return[a]},set:function(b){a=b}},name:{value:"svelte"},version:{value:"1.2.0"}})}var d={domready:function(a){var c=b.readyState;"complete"===c||"loaded"===c?a():b.addEventListener("DOMContentLoaded",a)},each:function(a){for(var b=0;b0||this.selector[0].offsetHeight>0},toggle:function(){return this.each(function(a){a.style.display=""===a.style.display||"block"===a.style.display?"none":"block"})},addClass:function(a){return this.each(function(b){b.classList.add(a)})},removeClass:function(a){return this.each(function(b){b.classList.remove(a)})},toggleClass:function(a){return this.each(function(b){b.classList.toggle(a)})},hasClass:function(a){return this.selector[0].classList.contains(a)},on:function(a,b){return this.each(function(c){c.addEventListener(a,b)})},one:function(a,b){return this.each(function(c){var d=function(){b(),c.removeEventListener(a,d)};c.addEventListener(a,d)})},off:function(a,b){return this.each(function(c){c.removeEventListener(a,b)})},focus:function(){return this.selector[0].focus(),this},trigger:function(a,c){return this.each(function(d){var e=c?new CustomEvent(a,c):b.createEvent("HTMLEvents");c||e.initEvent(a,!0,!1),d.dispatchEvent(e)})},ajax:function(a){var b=new XMLHttpRequest;a.url=a.url||location.href,a.data=a.data||null,a.type=a.type||"GET",a.cache=a.cache||!0,a.success=a.success||function(){},a.error=a.error||function(){};var c=a.cache?a.url+(/\?/.test(a.url)?"&":"?")+(new Date).getTime():a.url;b.open(a.type,c),"POST"===a.type&&b.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),b.send(a.data),b.onreadystatechange=function(){4===b.readyState&&(200===b.status?a.success(b.responseText):a.error(b.statusText))}},prev:function(){return this.selector=this.selector[0].previousElementSibling,this},next:function(){return this.selector=this.selector[0].nextElementSibling,this},first:function(){return this.selector=this.selector[0],this},last:function(){var a=this.selector.length;return this.selector=this.selector.slice(a-1,a),this},parent:function(){return this.selector=this.selector[0].parentNode,this},children:function(){return this.selector.slice.call(this.selector[0].children),this},append:function(a,b){return this.each(function(c){switch(a.toLowerCase()){case"before":return c.insertAdjacentHTML("beforebegin",b);case"after":return c.insertAdjacentHTML("afterend",b);case"atstart":return c.insertAdjacentHTML("afterbegin",b);case"atend":return c.insertAdjacentHTML("beforeend",b)}})},text:function(a){return a?this.each(function(b){b.textContent=a}):this.selector[0].textContent.trim()},html:function(a){return a?this.each(function(b){b.innerHTML=a}):this.selector[0].innerHTML},outerHTML:function(a){return a?this.each(function(b){b.outerHTML=a}):this.selector[0].outerHTML},empty:function(){return this.each(function(a){a.innerHTML=""})},clone:function(){return this.each(function(a){a.clodeNode(!0)})},remove:function(){return this.each(function(a){a.parentNode.removeChild(a)})},attr:function(a,b){return b?this.each(function(c){c.setAttribute(a,b)}):this.selector[0].getAttribute(a)},removeAttr:function(a){return this.each(function(b){b.removeAttribute(a)})},val:function(){return this.selector[0].value},length:function(){return this.selector.length},height:function(){return this.selector[0].offsetHeight},width:function(){return this.selector[0].offsetWidth},position:function(){return this.selector[0].getBoundingClientRect()},matches:function(a){var b=this.selector[0];return Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector,b.matches(a)}};a.$=c,a.$.fn=a.$.svelte=d,a.domready=d.domready,a.$.ready=d.domready}(window,document); +/*** svelte - 1.2.5 ***/ +!function(a,b){"use strict";function c(a,c){return Object.create(d,{s:{get:function(){if("string"==typeof a){for(var d=("string"===c?b.querySelectorAll(a):c)||b,e=d.querySelectorAll(a),f=[],g=0,h=f.length=e.length;h>g;g++)f[g]=e[g];return f}return[a]},set:function(b){a=b}}})}var d={domready:function(a){var c=b.readyState;"complete"===c||"loaded"===c?a():b.addEventListener("DOMContentLoaded",a)},each:function(a){for(var b=0,c=this.s.length;c>b;b++)a(this.s[b]);return this},find:function(a){return c(a,this.s[0])},css:function(a,b){return b?this.each(function(c){c.style[a]=b}):getComputedStyle(this.s[0])[a]},hide:function(){return this.each(function(a){a.style.display="none"})},show:function(){return this.each(function(a){a.style.display="block"})},visible:function(){return this.s[0].offsetWidth>0||this.s[0].offsetHeight>0},toggle:function(){return this.each(function(a){a.style.display=""===a.style.display||"block"===a.style.display?"none":"block"})},addClass:function(a){return this.each(function(b){b.classList.add(a)})},removeClass:function(a){return this.each(function(b){b.classList.remove(a)})},toggleClass:function(a){return this.each(function(b){b.classList.toggle(a)})},hasClass:function(a){return this.s.length>0?this.s[0].classList.contains(a):!1},on:function(a,b){return this.each(function(c){c.addEventListener(a,b)})},one:function(a,b){return this.each(function(c){var d=function(){b(),c.removeEventListener(a,d)};c.addEventListener(a,d)})},off:function(a,b){return this.each(function(c){c.removeEventListener(a,b)})},focus:function(){return this.s[0].focus(),this},trigger:function(a,c){return this.each(function(d){var e=c?new CustomEvent(a,c):b.createEvent("HTMLEvents");c||e.initEvent(a,!0,!1),d.dispatchEvent(e)})},ajax:function(a){var b=new XMLHttpRequest;a.url=a.url||location.href,a.data=a.data||null,a.type=a.type||"GET",a.cache=a.cache||!0,a.success=a.success||function(){},a.error=a.error||function(){};var c=a.cache?a.url+(/\?/.test(a.url)?"&":"?")+(new Date).getTime():a.url;b.open(a.type,c),"POST"===a.type&&b.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),b.send(a.data),b.onreadystatechange=function(){4===b.readyState&&(200===b.status?a.success(b.responseText):a.error(b.statusText))}},prev:function(){return this.s=this.s[0].previousElementSibling,this},next:function(){return this.s=this.s[0].nextElementSibling,this},first:function(){return this.s=this.s[0],this},last:function(){var a=this.s.length;return this.s=this.s.slice(a-1,a),this},parent:function(){return this.s=this.s[0].parentNode,this},children:function(){return this.s.slice.call(this.s[0].children),this},append:function(a,b){return this.each(function(c){switch(a.toLowerCase()){case"before":return c.insertAdjacentHTML("beforebegin",b);case"after":return c.insertAdjacentHTML("afterend",b);case"atstart":return c.insertAdjacentHTML("afterbegin",b);case"atend":return c.insertAdjacentHTML("beforeend",b)}})},text:function(a){return a?this.each(function(b){b.textContent=a}):this.s[0].textContent.trim()},html:function(a){return a?this.each(function(b){b.innerHTML=a}):this.s[0].innerHTML},outerHTML:function(a){return a?this.each(function(b){b.outerHTML=a}):this.s[0].outerHTML},empty:function(){return this.each(function(a){a.innerHTML=""})},clone:function(){return this.each(function(a){a.clodeNode(!0)})},remove:function(){return this.each(function(a){a.parentNode.removeChild(a)})},attr:function(a,b){return b?this.each(function(c){c.setAttribute(a,b)}):this.s[0].getAttribute(a)},removeAttr:function(a){return this.each(function(b){b.removeAttribute(a)})},val:function(){return this.s[0].value},length:function(){return this.s.length},height:function(){return this.s[0].offsetHeight},width:function(){return this.s[0].offsetWidth},position:function(){return this.s[0].getBoundingClientRect()},matches:function(a){var b=this.s[0];return Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector,b.matches(a)}};a.$=a.svelte=a.s=c,a.$.fn=d,a.domready=d.domready}(window,document); //# sourceMappingURL=svelte.min.map \ No newline at end of file diff --git a/svelte.min.map b/svelte.min.map index 36595e3..3c0e1a2 100644 --- a/svelte.min.map +++ b/svelte.min.map @@ -1 +1 @@ -{"version":3,"file":"svelte.min.js","sources":["svelte.js"],"names":["window","document","$","selector","context","Object","create","svelte","get","startAt","querySelectorAll","slice","call","set","value","name","version","domready","callback","readyState","addEventListener","each","i","this","length","find","css","property","el","style","getComputedStyle","hide","display","show","visible","offsetWidth","offsetHeight","toggle","addClass","className","classList","add","removeClass","remove","toggleClass","hasClass","contains","on","one","callbackWithRemove","removeEventListener","off","focus","trigger","detail","triggerEvent","CustomEvent","createEvent","initEvent","dispatchEvent","ajax","options","httpRequest","XMLHttpRequest","url","location","href","data","type","cache","success","error","pageUrl","test","Date","getTime","open","setRequestHeader","send","onreadystatechange","status","responseText","statusText","prev","previousElementSibling","next","nextElementSibling","first","last","arrayLength","parent","parentNode","children","append","position","html","toLowerCase","insertAdjacentHTML","text","textContent","trim","innerHTML","outerHTML","empty","clone","clodeNode","removeChild","attr","setAttribute","getAttribute","removeAttr","removeAttribute","val","height","width","getBoundingClientRect","matches","Element","prototype","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","fn","ready"],"mappings":";CAMC,SAAUA,EAAQC,GAEnB,YAylBA,SAASC,GAAEC,EAAUC,GACjB,MAAOC,QAAOC,OAAOC,GACjBJ,UACIK,IAAK,WACD,GAAwB,gBAAdL,GAAwB,CAC9B,GAAIM,IAAyB,WAAbL,EAAyBH,EAASS,iBAAiBP,GAAYC,IAAYH,CAC3F,UAAUU,MAAMC,KAAKH,EAAQC,iBAAiBP,IAE9C,OAAQA,IAGhBU,IAAK,SAASC,GACVX,EAAWW,IAGnBC,MACID,MAAO,UAEXE,SACIF,MAAO,WA1mBnB,GAAIP,IAUAU,SAAU,SAASC,GACf,GAAIC,GAAalB,EAASkB,UACR,cAAfA,GAA4C,WAAfA,EAC5BD,IAEAjB,EAASmB,iBAAiB,mBAAoBF,IAYtDG,KAAM,SAASH,GACX,IAAK,GAAII,GAAI,EAAGA,EAAIC,KAAKpB,SAASqB,OAAQF,IACtCJ,EAASK,KAAKpB,SAASmB,GAK3B,OAAOC,OAWXE,KAAM,SAAStB,GACX,MAAOD,GAAEC,EAAUoB,KAAKpB,SAAS,KAYrCuB,IAAK,SAASC,EAAUb,GACpB,MAAGA,GACQS,KAAKF,KAAK,SAASO,GACtBA,EAAGC,MAAMF,GAAYb,IAGlBgB,iBAAiBP,KAAKpB,SAAS,IAAIwB,IAWlDI,KAAM,WACF,MAAOR,MAAKF,KAAK,SAASO,GACtBA,EAAGC,MAA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2D,SAAU,WACN,MAAOvE,MAAKpB,SAAS,GAAGgH,yBAW5BC,QAAS,SAASjH,GACd,GAAIyB,GAAKL,KAAKpB,SAAS,EAGvB,OADAkH,SAAQC,UAAUF,QAAWC,QAAQC,UAAUF,SAAWC,QAAQC,UAAUC,iBAAmBF,QAAQC,UAAUE,mBAAqBH,QAAQC,UAAUG,oBAAsBJ,QAAQC,UAAUI,sBACzL9F,EAAGwF,QAAQjH,IA+B1BH,GAAOE,EAAIA,EAGXF,EAAOE,EAAEyH,GAAK3H,EAAOE,EAAEK,OAASA,EAGhCP,EAAOiB,SAAWV,EAAOU,SAGzBjB,EAAOE,EAAE0H,MAAQrH,EAAOU,UAEtBjB,OAAQC"} \ No newline at end of file +{"version":3,"file":"svelte.min.js","sources":["svelte.js"],"names":["window","document","svelte","selector","context","Object","create","svelteProto","s","get","startAt","querySelectorAll","nl","arr","i","len","length","set","value","domready","callback","readyState","addEventListener","each","this","find","css","property","el","style","getComputedStyle","hide","display","show","visible","offsetWidth","offsetHeight","toggle","addClass","className","classList","add","removeClass","remove","toggleClass","hasClass","contains","on","name","one","callbackWithRemove","removeEventListener","off","focus","trigger","detail","triggerEvent","CustomEvent","createEvent","initEvent","dispatchEvent","ajax","options","httpRequest","XMLHttpRequest","url","location","href","data","type","cache","success","error","pageUrl","test","Date","getTime","open","setRequestHeader","send","onreadystatechange","status","responseText","statusText","prev","previousElementSibling","next","nextElementSibling","first","last","arrayLength","slice","parent","parentNode","children","call","append","position","html","toLowerCase","insertAdjacentHTML","text","textContent","trim","innerHTML","outerHTML","empty","clone","clodeNode","removeChild","attr","setAttribute","getAttribute","removeAttr","removeAttribute","val","height","width","getBoundingClientRect","matches","Element","prototype","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","$","fn"],"mappings":";CAMC,SAAUA,EAAQC,GAEnB,YA0lBA,SAASC,GAAOC,EAAUC,GACtB,MAAOC,QAAOC,OAAOC,GACjBC,GACIC,IAAK,WACD,GAAwB,gB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B,SAAWZ,EAAYY,UAE5BnB,OAAQC"} \ No newline at end of file diff --git a/test/index.html b/test/index.html index d225c8e..4279be4 100644 --- a/test/index.html +++ b/test/index.html @@ -158,7 +158,7 @@

ajax

console.log($(".test-attr").attr('data-attr')); - console.log($('.test-toggle-trigger').selector[0].getBoundingClientRect().left); + console.log($('.test-toggle-trigger').s[0].getBoundingClientRect().left); // Ajax $.fn.ajax({