From 40e01afa16d034b1d7317aa9d5db2dfb5bca388f Mon Sep 17 00:00:00 2001 From: Serguei Shimansky Date: Thu, 4 May 2017 21:30:54 +0300 Subject: [PATCH 1/2] Update classList.js see [Incorrect "Confusing use of '!'" warning #780](here https://github.com/jshint/jshint/issues/780) --- classList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classList.js b/classList.js index ccc797b..85d38c1 100644 --- a/classList.js +++ b/classList.js @@ -225,7 +225,9 @@ if (objCtr.defineProperty) { var _toggle = DOMTokenList.prototype.toggle; DOMTokenList.prototype.toggle = function(token, force) { - if (1 in arguments && !this.contains(token) === !force) { + var _ntoken = !this.contains(token), + _nforce = !force; + if (1 in arguments && _ntoken === _nforce) { return force; } else { return _toggle.call(this, token); From 684b97f24689384b9dac6c4bb4f25c693cca57d5 Mon Sep 17 00:00:00 2001 From: Serguei Shimansky Date: Thu, 4 May 2017 21:32:13 +0300 Subject: [PATCH 2/2] Update classList.min.js see [Incorrect "Confusing use of '!'" warning #780](here https://github.com/jshint/jshint/issues/780) --- classList.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classList.min.js b/classList.min.js index 296b1b6..86a26d4 100644 --- a/classList.min.js +++ b/classList.min.js @@ -1,2 +1,2 @@ /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */ -"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",""+this)}},u=l[n]=[],h=function(){return new l(this)};if(a[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",-1!==c(this,t)},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",-1===c(this,t)&&(this.push(t),s=!0);while(++nn;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}t=null}()); +"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",""+this)}},u=l[n]=[],h=function(){return new l(this)};if(a[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",-1!==c(this,t)},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",-1===c(this,t)&&(this.push(t),s=!0);while(++nn;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){var i=!this.contains(t),s=!e;return 1 in arguments&&i===s?e:n.call(this,t)}}t=null}());