Permalink
Please sign in to comment.
Browse files
fixed old SCG classList and added new query and queryAll methods
- Loading branch information...
Showing
with
339 additions
and 232 deletions.
- +8 −0 .travis.yml
- +2 −1 README.md
- +1 −1 bower.json
- +1 −1 build/dom4.js
- +116 −83 build/dom4.max.js
- +1 −1 cdnjs.json
- +10 −2 package.json
- +116 −83 src/dom4.js
- +45 −60 test/dom4.js
- +39 −0 testrunner.js
| @@ -0,0 +1,8 @@ | ||
| +language: node_js | ||
| +node_js: | ||
| + - 0.12 | ||
| +git: | ||
| + depth: 1 | ||
| +branches: | ||
| + only: | ||
| + - master |
| @@ -1,2 +1,2 @@ | ||
| /*! (C) WebReflection Mit Style License */ | ||
| -(function(e){"use strict";function t(t){return typeof t=="string"?e.document.createTextNode(t):t}function n(n){if(n.length===1)return t(n[0]);for(var r=e.document.createDocumentFragment(),i=v.call(n),s=0;s<n.length;s++)r.appendChild(t(i[s]));return r}for(var r=Object.defineProperty||function(e,t,n){e.__defineGetter__(t,n.get)},i=[].indexOf||function(t){var n=this.length;while(n--)if(this[n]===t)break;return n},s,o,u,a,f=/^\s+|\s+$/g,l=/\s+/,c=" ",h=function(t,n){if(this.contains(t))n||this.remove(t);else if(n===undefined||n)n=!0,this.add(t);return!!n},p=(e.Element||e.Node||e.HTMLElement).prototype,d=["matches",p.matchesSelector||p.webkitMatchesSelector||p.khtmlMatchesSelector||p.mozMatchesSelector||p.msMatchesSelector||p.oMatchesSelector||function(t){var n=this.parentNode;return!!n&&-1<i.call(n.querySelectorAll(t),this)},"closest",function(t){var n=this,r;while((r=n&&n.matches)&&!n.matches(t))n=n.parentNode;return r?n:null},"prepend",function(){var t=this.firstChild,r=n(arguments);t?this.insertBefore(r,t):this.appendChild(r)},"append",function(){this.appendChild(n(arguments))},"before",function(){var t=this.parentNode;t&&t.insertBefore(n(arguments),this)},"after",function(){var t=this.parentNode,r=this.nextSibling,i=n(arguments);t&&(r?t.insertBefore(i,r):t.appendChild(i))},"replace",function(){this.replaceWith.apply(this,arguments)},"replaceWith",function(){var t=this.parentNode;t&&t.replaceChild(n(arguments),this)},"remove",function(){var t=this.parentNode;t&&t.removeChild(this)}],v=d.slice,m=d.length;m;m-=2)o=d[m-2],o in p||(p[o]=d[m-1]);document.createElement("a").matches("a")||(p[o]=function(e){return function(t){return e.call(this.parentNode?this:document.createDocumentFragment().appendChild(this),t)}}(p[o])),"classList"in document.documentElement?(a=document.createElement("div").classList,a.add("a","b","a"),"a b"!=a&&(p=a.constructor.prototype,"add"in p||(p=e.DOMTokenList.prototype),u=function(e){return function(){var t=0;while(t<arguments.length)e.call(this,arguments[t++])}},p.add=u(p.add),p.remove=u(p.remove),p.toggle=h)):(u=function(e){if(!e)throw"SyntaxError";if(l.test(e))throw"InvalidCharacterError";return e},a=function(e){var t=e.className,n=(typeof t=="object"?t.baseVal:t).replace(f,"");n.length&&d.push.apply(this,n.split(l)),this._=e},a.prototype={length:0,add:function(){for(var t=0,n;t<arguments.length;t++)n=arguments[t],this.contains(n)||d.push.call(this,o);this._.className=""+this},contains:function(e){return function(n){return m=e.call(this,o=u(n)),-1<m}}([].indexOf||function(e){m=this.length;while(m--&&this[m]!==e);return m}),item:function(t){return this[t]||null},remove:function(){for(var t=0,n;t<arguments.length;t++)n=arguments[t],this.contains(n)&&d.splice.call(this,m,1);this._.className=""+this},toggle:h,toString:function y(){return d.join.call(this,c)}},r(p,"classList",{get:function(){return new a(this)},set:function(){}})),"head"in document||r(document,"head",{get:function(){return s||(s=document.getElementsByTagName("head")[0])}});try{new e.CustomEvent("?")}catch(g){e.CustomEvent=function(e,t){function n(n,i){var s=document.createEvent(e);if(typeof n!="string")throw new Error("An event name must be provided");return e=="Event"&&(s.initCustomEvent=r),i==null&&(i=t),s.initCustomEvent(n,i.bubbles,i.cancelable,i.detail),s}function r(e,t,n,r){this.initEvent(e,t,n),this.detail=r}return n}(e.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}})(window); | ||
| +(function(e){"use strict";function t(e){return typeof e=="string"?a.createTextNode(e):e}function n(e){if(e.length===1)return t(e[0]);for(var n=a.createDocumentFragment(),r=S.call(e),i=0;i<e.length;i++)n.appendChild(t(r[i]));return n}for(var r,i,s,o,u,a=e.document,f=Object.defineProperty||function(e,t,n){e.__defineGetter__(t,n.get)},l=[].indexOf||function(t){var n=this.length;while(n--)if(this[n]===t)break;return n},c=function(e){if(!e)throw"SyntaxError";if(v.test(e))throw"InvalidCharacterError";return e},h=function(e){var t=e.className,n=typeof t=="object",r=(n?t.baseVal:t).replace(d,"");r.length&&E.push.apply(this,r.split(v)),this._isSVG=n,this._=e},p={get:function(){return new h(this)},set:function(){}},d=/^\s+|\s+$/g,v=/\s+/,m=" ",g="classList",y=function(t,n){if(this.contains(t))n||this.remove(t);else if(n===undefined||n)n=!0,this.add(t);return!!n},b=(e.Element||e.Node||e.HTMLElement).prototype,w=e.SVGElement,E=["matches",b.matchesSelector||b.webkitMatchesSelector||b.khtmlMatchesSelector||b.mozMatchesSelector||b.msMatchesSelector||b.oMatchesSelector||function(t){var n=this.parentNode;return!!n&&-1<l.call(n.querySelectorAll(t),this)},"closest",function(t){var n=this,r;while((r=n&&n.matches)&&!n.matches(t))n=n.parentNode;return r?n:null},"prepend",function(){var t=this.firstChild,r=n(arguments);t?this.insertBefore(r,t):this.appendChild(r)},"append",function(){this.appendChild(n(arguments))},"before",function(){var t=this.parentNode;t&&t.insertBefore(n(arguments),this)},"after",function(){var t=this.parentNode,r=this.nextSibling,i=n(arguments);t&&(r?t.insertBefore(i,r):t.appendChild(i))},"replace",function(){this.replaceWith.apply(this,arguments)},"replaceWith",function(){var t=this.parentNode;t&&t.replaceChild(n(arguments),this)},"remove",function(){var t=this.parentNode;t&&t.removeChild(this)},"query",function(t){return this.querySelector(t)},"queryAll",function(t){var n=this.querySelectorAll(t),r=n.length,i=new Array(r);while(r--)i[r]=n[r];return i}],S=E.slice,x=E.length;x;x-=2)i=E[x-2],i in b||(b[i]=E[x-1]);a.createElement("a").matches("a")||(b[i]=function(e){return function(t){return e.call(this.parentNode?this:a.createDocumentFragment().appendChild(this),t)}}(b[i])),h.prototype={length:0,add:function(){for(var t=0,n;t<arguments.length;t++)n=arguments[t],this.contains(n)||E.push.call(this,i);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},contains:function(e){return function(n){return x=e.call(this,i=c(n)),-1<x}}([].indexOf||function(e){x=this.length;while(x--&&this[x]!==e);return x}),item:function(t){return this[t]||null},remove:function(){for(var t=0,n;t<arguments.length;t++)n=arguments[t],this.contains(n)&&E.splice.call(this,x,1);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},toggle:y,toString:function N(){return E.join.call(this,m)}},w&&!(g in w.prototype)&&f(w.prototype,g,p),g in a.documentElement?(o=a.createElement("div")[g],o.add("a","b","a"),"a b"!=o&&(s=o.constructor.prototype,"add"in s||(s=e.TemporaryTokenList.prototype),u=function(e){return function(){var t=0;while(t<arguments.length)e.call(this,arguments[t++])}},s.add=u(s.add),s.remove=u(s.remove),s.toggle=y)):f(b,g,p),"head"in a||f(a,"head",{get:function(){return r||(r=a.getElementsByTagName("head")[0])}});try{new e.CustomEvent("?")}catch(T){e.CustomEvent=function(e,t){function n(n,i){var s=a.createEvent(e);if(typeof n!="string")throw new Error("An event name must be provided");return e=="Event"&&(s.initCustomEvent=r),i==null&&(i=t),s.initCustomEvent(n,i.bubbles,i.cancelable,i.detail),s}function r(e,t,n,r){this.initEvent(e,t,n),this.detail=r}return n}(e.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}})(window); |
12
package.json
Oops, something went wrong.
0 comments on commit
da653ed