JSFiddle - React, Tailwind, and code Playground
by ktstowell
HTML
<a href="#" id="log-link">Click me!</a>
JavaScript
_utils: {
/**
* -----------------
* LOGGING SUBMODULE
* -----------------
*/
_logging: {
/**
* INIT
* @description logging constructor
* @param {obj} args module options
* @return {obj} ATS root object
*/
init: function(args) {
var self = this;
// Members
this.root = ATS.fn; // Root object
// Logging Members
this.selector = $(this.root.selector); // Root selector, wrapped as a jQuery selector so always an array
args = args || {}; // Passed arguments
// Default Members
this.defaults = {
nodeName: true,
tagName: true,
type: true,
localName: true,
className: true,
attributes: true,
id: true,
value: true,
all: true,
children: true,
childNodes: true,
activeElement: true,
width: true,
height: true,
stylesheets: true,
images: true,
forms: true
};
// Extended args
this.obj_props = $.extend({}, this.defaults, args);
// Execute logging
this.log();
// Return chainable object
return ATS;
},
/**
* LOG
* @description parses DOM properties of given selector and logs them according to the options
*/
log: function() {
var self = this;
try {
for(var i=0;i<this.selector.length; i++) {
// Log the selector passed to ATS
console.log('ROOT: ', this.selector[i]);
for(var prop in this.selector[i]) {
if(this.obj_props.hasOwnProperty(prop) && this.obj_props[prop] == true && this.selector[i][prop] && this.selector[i][prop].length > 0) {
// Immediate properties of the root selector
console.log('|-->', prop, ': ', this.selector[i][prop]);
for(var sub in this.selector[i][prop]) {
if(typeof this.selector[i][prop][sub] === 'object' && this.selector[i][prop][sub] !== "" &&...