-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proxy dot-traversal into first element #13
Comments
Yeah, i figured someone would complain about this someday. The trouble is with non-uniform structures in the same list. Your list has all ul that contain lis in it, so HTML.body.ul.li makes all the sense in the world. But what about HTML.query('.foo') where there are multiple .foo elements that all are different tags and have different child tags? It gets messy, and could even become a performance drag for large lists with many/diverse child elements. Basically, i tried to keep it simple here. I knew that cases like HTML.body.ul.li could always be worked around: HTML.body.ul.query('li'), but that if i proxied all child elements from all list members that people working with large/diverse lists could get confusing/slow proxied getters even if they were not using them. I could probably be swayed on this, but for now, i thinking avoiding a potential problem that couldn't be worked around easily is better than creating a surprising behavior that can be worked around easily. |
Oh, and let's leave this open for others to comment. I'm very interested in hearing from the community on this one. |
Thanks for explain. |
Im learning DOM from the code, I dont understand why you offer the first element instead of traverse it.
eg: I have two ul elements.
now HTML.body.ul.li only get the first ul's li, its very odd. and the second ul dont inherit any methods, i must use HTML.ify to initial it by manully.
How about write like this:
The text was updated successfully, but these errors were encountered: