Created
October 19, 2016 14:52
-
-
Save lsongdev/d48d8481195befa3e4c05854224ed41f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ( | |
| a, // A Nodelist whichto use as root | |
| b, // iterate-placeholder | |
| c, // elem-placeholder | |
| d, // tags-placeholder | |
| e, // tag-placeholder | |
| f // parent-placeholder | |
| ) { | |
| for (b = 0; c = a[b++]; | |
| // parent has already the same `tagName` as property | |
| // so there is more than one element in the tree | |
| (f = c.parentNode)[e] && f[d].push(c) || | |
| // otherwise add/assign an array | |
| // containing the element | |
| (f[d] = [c]), | |
| // assign the single node to the parent-node | |
| f[e] = c) | |
| d = (e = c.tagName.toLowerCase()) + 's' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment