Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

domtokenlist-shim

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domtokenlist-shim - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

src/svg.classList.js

4

CHANGELOG.md
# Changelog
## 1.2.0 (2016-04-13)
* Added support for SVG elements. (props [@rodneyrehm](https://github.com/rodneyrehm))
* Allow for loading in non-browser environments. (props [@rodneyrehm](https://github.com/rodneyrehm))
## 1.1.1 (2015-11-25)

@@ -3,0 +7,0 @@ * Fixed illegal `relList` constructor. (props [@TrySound](https://github.com/TrySound))

@@ -1,3 +0,3 @@

/*! DOMTokenlist shim | Copyright 2015 Jonathan Wilsson and Bogdan Chadkin. */
;(function (window) {
/*! DOMTokenlist shim | Copyright 2016 Jonathan Wilsson and Bogdan Chadkin. */
;typeof window !== 'undefined' && (function (window) {
'use strict';

@@ -49,3 +49,3 @@

;(function (window) {
;typeof window !== 'undefined' && (function (window) {
'use strict';

@@ -180,6 +180,6 @@

;(function () {
;typeof window !== 'undefined' && (function () {
'use strict';
if ('classList' in document.createElement('a') && !window.QUnit) {
if ('classList' in document.createElement('a')) {
return;

@@ -195,6 +195,6 @@ }

;(function () {
;typeof window !== 'undefined' && (function () {
'use strict';
if ('relList' in document.createElement('a') && !window.QUnit) {
if ('relList' in document.createElement('a')) {
return;

@@ -215,1 +215,30 @@ }

}());
;typeof window !== 'undefined' && (function () {
'use strict';
if (typeof SVGElement === 'undefined') {
// IE8 does not support SVG and would throw
// "Object doesn't support this method or property"
return;
}
// https://connect.microsoft.com/IE/feedback/details/1046039/classlist-not-working-on-svg-elements
var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
if ('classList' in svg && !window.QUnit) {
return;
}
Object.defineProperty(SVGElement.prototype, 'classList', {
get: function () {
if (typeof this.className === 'string') {
return new DOMTokenList(this, 'className');
}
// in SVG world className may not be a DOMString, but a SVGAnimatedString
// https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedString
if (typeof this.className.baseVal === 'string') {
return new DOMTokenList(this.className, 'baseVal');
}
}
});
}());

4

dist/domtokenlist.min.js

@@ -1,2 +0,2 @@

/*! DOMTokenlist shim | Copyright 2015 Jonathan Wilsson and Bogdan Chadkin. */
!function(t){"use strict";if(t.DOMTokenList){var e=document.createElement("a").classList,n=DOMTokenList.prototype,r=n.add,i=n.remove,o=n.toggle;e.add("c1","c2");var c=function(t){return function(){var e,n=arguments;for(e=0;e<n.length;e+=1)t.call(this,n[e])}};e.contains("c2")||(n.add=c(r),n.remove=c(i)),e.toggle("c1",!0)||(n.toggle=function(t,e){return void 0===e?o.call(this,t):((e?r:i).call(this,t),!!e)})}}(window),function(t){"use strict";var e=[],n=function(t,n){var r;if(e.indexOf)return e.indexOf.call(t,n);for(r=0;r<t.length;r++)if(t[r]===n)return r;return-1},r=function(t){var e=/[\u0009\u000A\u000C\u000D\u0020]/;if(""===t||e.test(t))throw new Error("Token must not be empty or contain whitespace.")},i=function(t,e){var n,r=this,i=[];if(t&&e&&(r.element=t,r.prop=e,t[e]))for(i=t[e].replace(/^\s+|\s+$/g,"").split(/\s+/),n=0;n<i.length;n++)r[n]=i[n];r.length=i.length};i.prototype={add:function(){var t,n=this,i=arguments;for(t=0;t<i.length;t++)r(i[t]),n.contains(i[t])||e.push.call(n,i[t]);n.element&&(n.element[n.prop]=n)},contains:function(t){return r(t),-1!==n(this,t)},item:function(t){return this[t]||null},remove:function(){var t,i,o=arguments,c=this;for(i=0;i<o.length;i++)r(o[i]),t=n(c,o[i]),-1!==t&&e.splice.call(c,t,1);c.element&&(c.element[c.prop]=c)},toggle:function(t,e){var n=this;return n.contains(t)?e?!0:(n.remove(t),!1):e===!1?!1:(n.add(t),!0)},toString:function(){return e.join.call(this," ")}},t.DOMTokenList=i}(window),function(){"use strict";"classList"in document.createElement("a")&&!window.QUnit||Object.defineProperty(Element.prototype,"classList",{get:function(){return new DOMTokenList(this,"className")}})}(),function(){"use strict";if(!("relList"in document.createElement("a"))||window.QUnit){var t,e=[HTMLAnchorElement,HTMLAreaElement,HTMLLinkElement],n=function(){return new DOMTokenList(this,"rel")};for(t=0;t<e.length;t++)Object.defineProperty(e[t].prototype,"relList",{get:n})}}();
/*! DOMTokenlist shim | Copyright 2016 Jonathan Wilsson and Bogdan Chadkin. */
"undefined"!=typeof window&&function(e){"use strict";if(e.DOMTokenList){var t=document.createElement("a").classList,n=DOMTokenList.prototype,i=n.add,o=n.remove,r=n.toggle;t.add("c1","c2");var s=function(e){return function(){var t,n=arguments;for(t=0;t<n.length;t+=1)e.call(this,n[t])}};t.contains("c2")||(n.add=s(i),n.remove=s(o)),t.toggle("c1",!0)||(n.toggle=function(e,t){return void 0===t?r.call(this,e):((t?i:o).call(this,e),!!t)})}}(window),"undefined"!=typeof window&&function(e){"use strict";var t=[],n=function(e,n){var i;if(t.indexOf)return t.indexOf.call(e,n);for(i=0;i<e.length;i++)if(e[i]===n)return i;return-1},i=function(e){var t=/[\u0009\u000A\u000C\u000D\u0020]/;if(""===e||t.test(e))throw new Error("Token must not be empty or contain whitespace.")},o=function(e,t){var n,i=this,o=[];if(e&&t&&(i.element=e,i.prop=t,e[t]))for(o=e[t].replace(/^\s+|\s+$/g,"").split(/\s+/),n=0;n<o.length;n++)i[n]=o[n];i.length=o.length};o.prototype={add:function(){var e,n=this,o=arguments;for(e=0;e<o.length;e++)i(o[e]),n.contains(o[e])||t.push.call(n,o[e]);n.element&&(n.element[n.prop]=n)},contains:function(e){return i(e),-1!==n(this,e)},item:function(e){return this[e]||null},remove:function(){var e,o,r=arguments,s=this;for(o=0;o<r.length;o++)i(r[o]),e=n(s,r[o]),-1!==e&&t.splice.call(s,e,1);s.element&&(s.element[s.prop]=s)},toggle:function(e,t){var n=this;return n.contains(e)?t?!0:(n.remove(e),!1):t===!1?!1:(n.add(e),!0)},toString:function(){return t.join.call(this," ")}},e.DOMTokenList=o}(window),"undefined"!=typeof window&&function(){"use strict";"classList"in document.createElement("a")||Object.defineProperty(Element.prototype,"classList",{get:function(){return new DOMTokenList(this,"className")}})}(),"undefined"!=typeof window&&function(){"use strict";if(!("relList"in document.createElement("a"))){var e,t=[HTMLAnchorElement,HTMLAreaElement,HTMLLinkElement],n=function(){return new DOMTokenList(this,"rel")};for(e=0;e<t.length;e++)Object.defineProperty(t[e].prototype,"relList",{get:n})}}(),"undefined"!=typeof window&&function(){"use strict";if("undefined"!=typeof SVGElement){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");"classList"in e&&!window.QUnit||Object.defineProperty(SVGElement.prototype,"classList",{get:function(){return"string"==typeof this.className?new DOMTokenList(this,"className"):"string"==typeof this.className.baseVal?new DOMTokenList(this.className,"baseVal"):void 0}})}}();

@@ -10,3 +10,3 @@ var gulp = require('gulp');

var files = ['src/DOMTokenList-newest.js', 'src/DOMTokenList.js', 'src/classList.js', 'src/relList.js'];
var files = ['src/DOMTokenList-newest.js', 'src/DOMTokenList.js', 'src/classList.js', 'src/relList.js', 'src/svg.classList.js'];

@@ -13,0 +13,0 @@ gulp.task('build', function () {

{
"name": "domtokenlist-shim",
"version": "1.1.1",
"version": "1.2.0",
"description": "A super strict shim/polyfill for DOMTokenList",

@@ -22,6 +22,7 @@ "keywords": [

"gulp-jscs": "^3.0.0",
"gulp-jshint": "^1.11.0",
"gulp-jshint": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-size": "^2.0.0",
"gulp-uglify": "^1.2.0",
"jshint": "^2.9.1-rc2",
"qunitjs": "^1.18.0"

@@ -28,0 +29,0 @@ },

@@ -15,2 +15,3 @@ # DOMTokenList shim

* Android - 2.3+
* Edge - Current version and one version earlier
* Google Chrome - Current version and one version earlier

@@ -17,0 +18,0 @@ * Internet Explorer - 8+

@@ -1,5 +0,5 @@

;(function () {
;typeof window !== 'undefined' && (function () {
'use strict';
if ('classList' in document.createElement('a') && !window.QUnit) {
if ('classList' in document.createElement('a')) {
return;

@@ -6,0 +6,0 @@ }

@@ -1,2 +0,2 @@

;(function (window) {
;typeof window !== 'undefined' && (function (window) {
'use strict';

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

;(function (window) {
;typeof window !== 'undefined' && (function (window) {
'use strict';

@@ -3,0 +3,0 @@

@@ -1,5 +0,5 @@

;(function () {
;typeof window !== 'undefined' && (function () {
'use strict';
if ('relList' in document.createElement('a') && !window.QUnit) {
if ('relList' in document.createElement('a')) {
return;

@@ -6,0 +6,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc