Skip to content

Instantly share code, notes, and snippets.

View emdagon's full-sized avatar

Emilio Daniel González emdagon

View GitHub Profile
@weaver
weaver / make-selector.js
Created October 14, 2010 18:54
Create an absolute jQuery selector for a DOM element.
// Create an absolute jQuery selector for a DOM element.
//
// + el - Element to select.
//
// Returns String selector.
function makeSelector(el) {
var tag, index, stack = [];
for (; el.parentNode; el = el.parentNode) {
tag = el.tagName;