mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-01 23:37:43 +02:00
admin/javascript => admin/client admin/javascript/src => admin/client/src/legacy (mostly) admin/scss/_variables.scss => admin/client/styles/_variables.scss admin/scss => admin/client/styles/legacy/ admin/css/editor.css => admin/client/dist/css/editor.css admin/css/screen.css => admin/client/dist/css/bundle.css admin/images => admin/client/dist/images admin/images/sprites/src => admin/client/src/sprites admin/images/sprites/dist => admin/client/dist/sprites admin/font => admin/client/dist/font
67 lines
1.6 KiB
JavaScript
67 lines
1.6 KiB
JavaScript
(function (global, factory) {
|
|
if (typeof define === "function" && define.amd) {
|
|
define('ss.leaktools', ['jQuery'], factory);
|
|
} else if (typeof exports !== "undefined") {
|
|
factory(require('jQuery'));
|
|
} else {
|
|
var mod = {
|
|
exports: {}
|
|
};
|
|
factory(global.jQuery);
|
|
global.ssLeaktools = mod.exports;
|
|
}
|
|
})(this, function (_jQuery) {
|
|
'use strict';
|
|
|
|
var _jQuery2 = _interopRequireDefault(_jQuery);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : {
|
|
default: obj
|
|
};
|
|
}
|
|
|
|
var getHTML = function getHTML(el) {
|
|
var clone = el.cloneNode(true);
|
|
|
|
var div = (0, _jQuery2.default)('<div></div>');
|
|
div.append(clone);
|
|
|
|
return div.html();
|
|
};
|
|
|
|
_jQuery2.default.leaktools = {
|
|
|
|
logDuplicateElements: function logDuplicateElements() {
|
|
var els = (0, _jQuery2.default)('*');
|
|
var dirty = false;
|
|
|
|
els.each(function (i, a) {
|
|
els.not(a).each(function (j, b) {
|
|
if (getHTML(a) == getHTML(b)) {
|
|
dirty = true;
|
|
console.log(a, b);
|
|
}
|
|
});
|
|
});
|
|
|
|
if (!dirty) console.log('No duplicates found');
|
|
},
|
|
|
|
logUncleanedElements: function logUncleanedElements(clean) {
|
|
_jQuery2.default.each(_jQuery2.default.cache, function () {
|
|
var source = this.handle && this.handle.elem;
|
|
if (!source) return;
|
|
|
|
var parent = source;
|
|
while (parent && parent.nodeType == 1) {
|
|
parent = parent.parentNode;
|
|
}if (!parent) {
|
|
console.log('Unattached', source);
|
|
console.log(this.events);
|
|
if (clean) (0, _jQuery2.default)(source).unbind().remove();
|
|
} else if (parent !== document) console.log('Attached, but to', parent, 'not our document', source);
|
|
});
|
|
}
|
|
};
|
|
}); |