Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/layout/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ goog.scope(function() {
// This is a very defensive move, since a display: none item that
// is made visible when in a specific column or grid can really mess up a
// layout
debug.warn('Zero-height block ignored');
debug.warn('Zero-height block ignored: ' + debug.idnode(node));

this.ignore = true;
return;
Expand Down Expand Up @@ -588,7 +588,7 @@ goog.scope(function() {
Block.sanitizeNode = function(node, baseLineHeight) {
// Should never get text & comment nodes
if (node.nodeType !== 1) {
debug.error('Text node sent to sanitize: ' + node);
debug.error('Text node sent to sanitize: ' + debug.idnode(node));
return node;
}

Expand Down Expand Up @@ -702,7 +702,7 @@ goog.scope(function() {
if (metrics.outerH % baseLineHeight) {
// Shit, looks like even with the normalization, we're still out of
// sync. Use padding bottom to fix it up
debug.info('Forcing padding due to mismatch: ' + node);
debug.info('Forcing padding due to mismatch: ' + debug.idnode(node));

metrics.paddingBottom += baseLineHeight - metrics.outerH % baseLineHeight;

Expand Down
19 changes: 19 additions & 0 deletions src/lib/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ goog.scope(function() {
}
};

/**
* Helper that returns an identifying string for an HTML element
* @param {element} node
*/
debug.idnode = function (node) {
// data-sizes is as specific as we can get (id gets stripped)
var identifier = node.getAttribute('data-sizes');
if (goog.isString(identifier)) {
return node+' (data-sizes='+identifier+')';
}
// classes identify it better than nothing
identifier = node.getAttribute('class');
if (goog.isString(identifier)) {
return node+' (class='+identifier+')';
}
// Can't identify it, just return
return node;
};

/**
* Assert helper
* @param {boolean} assertion
Expand Down