Last Updated: February 25, 2016
·
913
· eriwen

DOM debugging helper functions

Paste these into your browser JavaScript console for navigating the DOM more quickly while debugging:

function $(id) {
    return document.getElementById(id);
}
function $t(tag, context) {
    return (context || document).getElementsByTagName(tag);
}
function $$(expr, context) {
    return (context || document).querySelectorAll(expr);
}

This works great with Chrome Canary's new Snippets feature.