Javascript crazy idea finding a node
Posted
by Louis
on Stack Overflow
See other posts from Stack Overflow
or by Louis
Published on 2010-04-18T10:36:16Z
Indexed on
2010/04/18
10:43 UTC
Read the original article
Hit count: 606
I had a crazy (but so crazy that it just might work) idea where every element on a page is created in javascript but given an ID which is a hash of its path in the DOM. So instead of searching through the DOM to find an element, you hash the path and then getElementById()
with that hash. Problem with this is getting the path might be more expensive than searching the DOM in the first place. Any ideas how this could be done or if it is just plain stupid?
© Stack Overflow or respective owner