{ | ||
"name": "dorsal", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"homepage": "http://eventbrite.github.io/dorsal/", | ||
@@ -5,0 +5,0 @@ "authors": [ |
Change Log | ||
========== | ||
0.6.2 | ||
----- | ||
- Added shim for `Object.keys` | ||
0.6.1 | ||
@@ -5,0 +9,0 @@ ----- |
@@ -17,3 +17,3 @@ /** | ||
/*! dorsal - v0.6.1 - 2015-04-08 */ | ||
/*! dorsal - v0.6.2 - 2015-04-09 */ | ||
@@ -66,2 +66,26 @@ (function(root, factory) { | ||
// from: http://underscorejs.org/docs/underscore.html#section-94 | ||
// except: not dealing with the bug with enum though. | ||
function keysFor(obj) { | ||
var keys = [], | ||
key; | ||
if (!obj) { | ||
return keys; | ||
} | ||
if (Object.keys) { | ||
return Object.keys(obj); | ||
} | ||
for (key in obj) { | ||
if (hasOwnProperty.call(obj, key)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
} | ||
var DorsalCore = function() {}; | ||
@@ -80,3 +104,3 @@ | ||
DorsalCore.prototype.VERSION = '0.6.1'; | ||
DorsalCore.prototype.VERSION = '0.6.2'; | ||
DorsalCore.prototype.CSS_PREFIX = '.js-d-'; | ||
@@ -213,3 +237,3 @@ DorsalCore.prototype.DATA_IGNORE_PREFIX = 'xd'; | ||
DorsalCore.prototype.registeredPlugins = function() { | ||
var pluginKeys = Object.keys(this.plugins); | ||
var pluginKeys = keysFor(this.plugins); | ||
@@ -216,0 +240,0 @@ if (!pluginKeys.length) { |
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
/*! dorsal - v0.6.1 - 2015-04-08 */ | ||
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define([],b):a.Dorsal=b()}(this,function(){function a(a){return 1===a.nodeType}function b(a,b){var c=a.length,d=0;if(a.indexOf)return a.indexOf(b);for(;c>d;d++)if(a[d]===b)return d;return-1}var c=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}(),d=function(){};d.prototype.VERSION="0.6.1",d.prototype.CSS_PREFIX=".js-d-",d.prototype.DATA_IGNORE_PREFIX="xd",d.prototype.DATA_PREFIX="d",d.prototype.DATA_DORSAL_WIRED="data-"+d.prototype.DATA_IGNORE_PREFIX+"-wired",d.prototype.GUID_KEY="dorsal-guid",d.prototype.ELEMENT_TO_PLUGINS_MAP={},d.prototype.DEBUG=!1,d.prototype.plugins={},d.prototype.registerPlugin=function(a,b){this.plugins[a]=b},d.prototype.unregisterPlugin=function(a){delete this.plugins[a]},d.prototype._getDatasetAttributes=function(a){var b=a.dataset,c={};for(var d in b)if(new RegExp("^"+this.DATA_PREFIX+"[A-Z]").test(d)){var e=d.substr(this.DATA_PREFIX.length),f=e[0].toLowerCase()+e.substr(1);c[f]=b[d]}return c},d.prototype._normalizeDataAttribute=function(a){return a.toUpperCase().replace("-","")},d.prototype._getDataAttributes=function(a){var b={},c=a.attributes,d=c.length,e="name",f=0;for(f=0;d>f;f++)if(new RegExp("^data-"+this.DATA_PREFIX+"-").test(c[f][e])){var g=c[f][e].substr(5+this.DATA_PREFIX.length+1).toLowerCase().replace(/(\-[a-zA-Z])/g,this._normalizeDataAttribute);b[g]=c[f].value}return b},d.prototype._getAttributes=function(a){return a.dataset?this._getDatasetAttributes(a):this._getDataAttributes(a)},d.prototype._runPlugin=function(a,b){var d=new DorsalLog(this.DEBUG);if(a.getAttribute(this.DATA_DORSAL_WIRED)&&-1!==a.getAttribute(this.DATA_DORSAL_WIRED).indexOf(b))return d.log("node already wired: "+a),!1;var e=this._getAttributes(a),f=a.getAttribute(this.DATA_DORSAL_WIRED),g=this.plugins[b],h={el:a,data:e},i=a.getAttribute(this.GUID_KEY);return i||(i=c(),a.setAttribute(this.GUID_KEY,i),this.ELEMENT_TO_PLUGINS_MAP[i]={}),d.log("plugin execution start",{guid:i,pluginName:b}),"function"==typeof g?this.ELEMENT_TO_PLUGINS_MAP[i][b]=g.call(a,h):"object"==typeof g&&(this.ELEMENT_TO_PLUGINS_MAP[i][b]=g.create.call(a,h)),d.log("plugin execution end",{guid:i,pluginName:b}),f?a.setAttribute(this.DATA_DORSAL_WIRED,f+" "+b):a.setAttribute(this.DATA_DORSAL_WIRED,b),i},d.prototype.registeredPlugins=function(){var a=Object.keys(this.plugins);return a.length||console&&console.warn&&console.warn("No plugins registered with Dorsal"),a},d.prototype._wireElementsFrom=function(a){var b,c,d,e=a&&"querySelectorAll"in a,f=this.registeredPlugins(),g=0,h=[];if(!e)return void log.log("invalid Node: "+prentNode);for(b=f[g++];b;)c=a.querySelectorAll(this.CSS_PREFIX+b),c.length&&(d=this._wireElements(c,[b]),h=h.concat(d)),b=f[g++];return h},d.prototype._wireElements=function(a,b){if(!a.length){var c=new DorsalLog(this.DEBUG);return void c.log("no nodes to wire: "+a)}for(var d=0,e=a[d++],f=[];e;)f.push(this._wireElement(e,b)),e=a[d++];return f},d.prototype._wireElement=function(a,b){var c=this,d=new DorsalDeferred,e=new DorsalLog(this.DEBUG);return window.setTimeout(function(){var f,g,h,i=a&&"className"in a,j=0;if(!i)return void e.log("invalid node to wire: "+a);for(b.length||(b=c.registeredPlugins()),g=b[j++];g;)f=c.CSS_PREFIX+g,a.className.indexOf(f.substr(1))>-1&&(h=c._runPlugin(a,g),d.notify(g,h,c),e.end(h)),g=b[j++];d.resolve()},0),d.promise()},d.prototype._detachPlugin=function(a,c){var e,f=!1;return"string"!=typeof a.getAttribute(this.DATA_DORSAL_WIRED)?!1:(a.getAttribute(this.DATA_DORSAL_WIRED).indexOf(c)>-1&&this.plugins[c].destroy&&(this.plugins[c].destroy({el:a,data:this._getAttributes(a),instance:this.ELEMENT_TO_PLUGINS_MAP[a.getAttribute(d.prototype.GUID_KEY)][c]}),f=!0),e=a.getAttribute(this.DATA_DORSAL_WIRED).split(" "),e.splice(b(e,c),1),a.setAttribute(this.DATA_DORSAL_WIRED,e.join(" ")),f)},d.prototype.unwire=function(a,b){if(b)return this._detachPlugin(a,b);for(var c,d=a.getAttribute(this.DATA_DORSAL_WIRED).split(" "),e=d.length,f=!1,g=0;e>g;g++)c=d[g],this._detachPlugin(a,c)&&(f=!0);return f},d.prototype.wire=function(b,c){var d,e=new DorsalDeferred(this.ELEMENT_TO_PLUGINS_MAP),f=[];if(arguments.length&&!b)return e.resolve().promise();switch(arguments.length){case 1:f=a(b)?this._wireElementsFrom(b):this._wireElements(b,[]);break;case 2:d=a(b)?"_wireElement":"_wireElements",f=this[d](b,[c]);break;default:f=this._wireElementsFrom(document)}return e.when(f)},d.prototype.rewire=function(a,b){var c;return this.unwire(a,b),b?c=this.wire(a,b):(a=[a],c=this.wire(a)),c},d.prototype.get=function(b){var c,d,e=[],f=0;for(a(b)&&(b=[b]),d=b[f++];d;)c=this._instancesFor(d),c&&e.push(c),d=b[f++];return e},d.prototype._instancesFor=function(b){var c=a(b)?b.getAttribute(this.GUID_KEY):b;return this.ELEMENT_TO_PLUGINS_MAP[c]};var e=new d;return e.create=function(){return new d},DorsalDeferred=function(a){var b,c="pending",d=[],e=[],f=[],g=this;b={state:function(){return g.state()},done:function(b){return"resolved"===c&&b.call(g,a),d.push(b),g.promise()},fail:function(b){return"rejected"===c&&b.call(g,a),e.push(b),g.promise()},progress:function(a){return f.push(a),g}},g.state=function(){return c},g.notify=function(){var a,b=f.length;for(a=0;b>a;a++)f[a].apply(g,arguments)},g.reject=function(){var b,d=e.length;for(c="rejected",b=0;d>b;b++)e[b].call(g,a);return g},g.resolve=function(){var b,e=d.length;for(c="resolved",b=0;e>b;b++)d[b].call(g,a);return g},g.promise=function(){return b},g.when=function(b){function c(){f++,f>=h&&i.resolve()}function d(){i.notify(g,arguments)}for(var e=0,f=0,h=b.length,i=new DorsalDeferred(a);h>e;e++)b[e].done(c).fail(c).progress(d);return h||i.resolve(),i.promise()}},DorsalHistoryLog={},DorsalLog=function(a){"use strict";var a=a||!1,b=(console&&console.log,DorsalHistoryLog),c=this,d=function(a,b){var c=b?"timeEnd":"time";console[c](a)},e=function(a){window.setTimeout(function(){var c=0,d=b[a]||[];if(d.length){console.group(a);for(var e=d[c++];e;)console[e.msgType||"log"](e.time,"message:",e.msg,"pluginName:",e.pluginName),e=d[c++];console.groupEnd(),delete b[a]}},0)},f=function(c,e,f){if(a){var f=f||{},g=f.guid;g?(d(g),b[g]||(b[g]=[]),b[g].push({msg:c,time:(new Date).getTime(),pluginName:f.pluginName,msgType:e})):console&&console[e]&&console[e](c)}};return c.active=function(){return a},c.end=function(a){d(a,!0),e(a)},c.log=function(a,b){f(a,"log",b)},c.warn=function(a,b){f(a,"warn",b)},c.info=function(a,b){f(a,"info",b)},c},e}); | ||
/*! dorsal - v0.6.2 - 2015-04-09 */ | ||
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define([],b):a.Dorsal=b()}(this,function(){function a(a){return 1===a.nodeType}function b(a,b){var c=a.length,d=0;if(a.indexOf)return a.indexOf(b);for(;c>d;d++)if(a[d]===b)return d;return-1}function c(a){var b,c=[];if(!a)return c;if(Object.keys)return Object.keys(a);for(b in a)hasOwnProperty.call(a,b)&&c.push(b);return c}var d=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}(),e=function(){};e.prototype.VERSION="0.6.2",e.prototype.CSS_PREFIX=".js-d-",e.prototype.DATA_IGNORE_PREFIX="xd",e.prototype.DATA_PREFIX="d",e.prototype.DATA_DORSAL_WIRED="data-"+e.prototype.DATA_IGNORE_PREFIX+"-wired",e.prototype.GUID_KEY="dorsal-guid",e.prototype.ELEMENT_TO_PLUGINS_MAP={},e.prototype.DEBUG=!1,e.prototype.plugins={},e.prototype.registerPlugin=function(a,b){this.plugins[a]=b},e.prototype.unregisterPlugin=function(a){delete this.plugins[a]},e.prototype._getDatasetAttributes=function(a){var b=a.dataset,c={};for(var d in b)if(new RegExp("^"+this.DATA_PREFIX+"[A-Z]").test(d)){var e=d.substr(this.DATA_PREFIX.length),f=e[0].toLowerCase()+e.substr(1);c[f]=b[d]}return c},e.prototype._normalizeDataAttribute=function(a){return a.toUpperCase().replace("-","")},e.prototype._getDataAttributes=function(a){var b={},c=a.attributes,d=c.length,e="name",f=0;for(f=0;d>f;f++)if(new RegExp("^data-"+this.DATA_PREFIX+"-").test(c[f][e])){var g=c[f][e].substr(5+this.DATA_PREFIX.length+1).toLowerCase().replace(/(\-[a-zA-Z])/g,this._normalizeDataAttribute);b[g]=c[f].value}return b},e.prototype._getAttributes=function(a){return a.dataset?this._getDatasetAttributes(a):this._getDataAttributes(a)},e.prototype._runPlugin=function(a,b){var c=new DorsalLog(this.DEBUG);if(a.getAttribute(this.DATA_DORSAL_WIRED)&&-1!==a.getAttribute(this.DATA_DORSAL_WIRED).indexOf(b))return c.log("node already wired: "+a),!1;var e=this._getAttributes(a),f=a.getAttribute(this.DATA_DORSAL_WIRED),g=this.plugins[b],h={el:a,data:e},i=a.getAttribute(this.GUID_KEY);return i||(i=d(),a.setAttribute(this.GUID_KEY,i),this.ELEMENT_TO_PLUGINS_MAP[i]={}),c.log("plugin execution start",{guid:i,pluginName:b}),"function"==typeof g?this.ELEMENT_TO_PLUGINS_MAP[i][b]=g.call(a,h):"object"==typeof g&&(this.ELEMENT_TO_PLUGINS_MAP[i][b]=g.create.call(a,h)),c.log("plugin execution end",{guid:i,pluginName:b}),f?a.setAttribute(this.DATA_DORSAL_WIRED,f+" "+b):a.setAttribute(this.DATA_DORSAL_WIRED,b),i},e.prototype.registeredPlugins=function(){var a=c(this.plugins);return a.length||console&&console.warn&&console.warn("No plugins registered with Dorsal"),a},e.prototype._wireElementsFrom=function(a){var b,c,d,e=a&&"querySelectorAll"in a,f=this.registeredPlugins(),g=0,h=[];if(!e)return void log.log("invalid Node: "+prentNode);for(b=f[g++];b;)c=a.querySelectorAll(this.CSS_PREFIX+b),c.length&&(d=this._wireElements(c,[b]),h=h.concat(d)),b=f[g++];return h},e.prototype._wireElements=function(a,b){if(!a.length){var c=new DorsalLog(this.DEBUG);return void c.log("no nodes to wire: "+a)}for(var d=0,e=a[d++],f=[];e;)f.push(this._wireElement(e,b)),e=a[d++];return f},e.prototype._wireElement=function(a,b){var c=this,d=new DorsalDeferred,e=new DorsalLog(this.DEBUG);return window.setTimeout(function(){var f,g,h,i=a&&"className"in a,j=0;if(!i)return void e.log("invalid node to wire: "+a);for(b.length||(b=c.registeredPlugins()),g=b[j++];g;)f=c.CSS_PREFIX+g,a.className.indexOf(f.substr(1))>-1&&(h=c._runPlugin(a,g),d.notify(g,h,c),e.end(h)),g=b[j++];d.resolve()},0),d.promise()},e.prototype._detachPlugin=function(a,c){var d,f=!1;return"string"!=typeof a.getAttribute(this.DATA_DORSAL_WIRED)?!1:(a.getAttribute(this.DATA_DORSAL_WIRED).indexOf(c)>-1&&this.plugins[c].destroy&&(this.plugins[c].destroy({el:a,data:this._getAttributes(a),instance:this.ELEMENT_TO_PLUGINS_MAP[a.getAttribute(e.prototype.GUID_KEY)][c]}),f=!0),d=a.getAttribute(this.DATA_DORSAL_WIRED).split(" "),d.splice(b(d,c),1),a.setAttribute(this.DATA_DORSAL_WIRED,d.join(" ")),f)},e.prototype.unwire=function(a,b){if(b)return this._detachPlugin(a,b);for(var c,d=a.getAttribute(this.DATA_DORSAL_WIRED).split(" "),e=d.length,f=!1,g=0;e>g;g++)c=d[g],this._detachPlugin(a,c)&&(f=!0);return f},e.prototype.wire=function(b,c){var d,e=new DorsalDeferred(this.ELEMENT_TO_PLUGINS_MAP),f=[];if(arguments.length&&!b)return e.resolve().promise();switch(arguments.length){case 1:f=a(b)?this._wireElementsFrom(b):this._wireElements(b,[]);break;case 2:d=a(b)?"_wireElement":"_wireElements",f=this[d](b,[c]);break;default:f=this._wireElementsFrom(document)}return e.when(f)},e.prototype.rewire=function(a,b){var c;return this.unwire(a,b),b?c=this.wire(a,b):(a=[a],c=this.wire(a)),c},e.prototype.get=function(b){var c,d,e=[],f=0;for(a(b)&&(b=[b]),d=b[f++];d;)c=this._instancesFor(d),c&&e.push(c),d=b[f++];return e},e.prototype._instancesFor=function(b){var c=a(b)?b.getAttribute(this.GUID_KEY):b;return this.ELEMENT_TO_PLUGINS_MAP[c]};var f=new e;return f.create=function(){return new e},DorsalDeferred=function(a){var b,c="pending",d=[],e=[],f=[],g=this;b={state:function(){return g.state()},done:function(b){return"resolved"===c&&b.call(g,a),d.push(b),g.promise()},fail:function(b){return"rejected"===c&&b.call(g,a),e.push(b),g.promise()},progress:function(a){return f.push(a),g}},g.state=function(){return c},g.notify=function(){var a,b=f.length;for(a=0;b>a;a++)f[a].apply(g,arguments)},g.reject=function(){var b,d=e.length;for(c="rejected",b=0;d>b;b++)e[b].call(g,a);return g},g.resolve=function(){var b,e=d.length;for(c="resolved",b=0;e>b;b++)d[b].call(g,a);return g},g.promise=function(){return b},g.when=function(b){function c(){f++,f>=h&&i.resolve()}function d(){i.notify(g,arguments)}for(var e=0,f=0,h=b.length,i=new DorsalDeferred(a);h>e;e++)b[e].done(c).fail(c).progress(d);return h||i.resolve(),i.promise()}},DorsalHistoryLog={},DorsalLog=function(a){"use strict";var a=a||!1,b=(console&&console.log,DorsalHistoryLog),c=this,d=function(a,b){var c=b?"timeEnd":"time";console[c](a)},e=function(a){window.setTimeout(function(){var c=0,d=b[a]||[];if(d.length){console.group(a);for(var e=d[c++];e;)console[e.msgType||"log"](e.time,"message:",e.msg,"pluginName:",e.pluginName),e=d[c++];console.groupEnd(),delete b[a]}},0)},f=function(c,e,f){if(a){var f=f||{},g=f.guid;g?(d(g),b[g]||(b[g]=[]),b[g].push({msg:c,time:(new Date).getTime(),pluginName:f.pluginName,msgType:e})):console&&console[e]&&console[e](c)}};return c.active=function(){return a},c.end=function(a){d(a,!0),e(a)},c.log=function(a,b){f(a,"log",b)},c.warn=function(a,b){f(a,"warn",b)},c.info=function(a,b){f(a,"info",b)},c},f}); |
{ | ||
"name": "dorsal", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "HTML UI bootstrap and automation using CSS directives", | ||
@@ -5,0 +5,0 @@ "homepage": "http://eventbrite.github.io/dorsal/", |
@@ -49,1 +49,25 @@ /* | ||
} | ||
// from: http://underscorejs.org/docs/underscore.html#section-94 | ||
// except: not dealing with the bug with enum though. | ||
function keysFor(obj) { | ||
var keys = [], | ||
key; | ||
if (!obj) { | ||
return keys; | ||
} | ||
if (Object.keys) { | ||
return Object.keys(obj); | ||
} | ||
for (key in obj) { | ||
if (hasOwnProperty.call(obj, key)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
} |
@@ -29,3 +29,3 @@ /* | ||
DorsalCore.prototype.VERSION = '0.6.1'; | ||
DorsalCore.prototype.VERSION = '0.6.2'; | ||
DorsalCore.prototype.CSS_PREFIX = '.js-d-'; | ||
@@ -162,3 +162,3 @@ DorsalCore.prototype.DATA_IGNORE_PREFIX = 'xd'; | ||
DorsalCore.prototype.registeredPlugins = function() { | ||
var pluginKeys = Object.keys(this.plugins); | ||
var pluginKeys = keysFor(this.plugins); | ||
@@ -165,0 +165,0 @@ if (!pluginKeys.length) { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
97304
1.03%1913
1.92%0
-100%