Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement document.getElementById #740
Comments
|
@ILyoan Are you working on this, or is this an open task? |
|
@jdm Not working, just opened. |
|
@mihneadb Sounds like you could jump on this if you're interested. |
|
May I try to implement this? |
|
Sure, go for it. Let me know if you change your mind. |
|
Thank you! 2013/8/24 Mihnea Dobrescu-Balaur notifications@github.com
saneyuki_s |
|
This is needed for #841. |
|
I think the basic logic of this should be:
But I'm worrying about these points.
How do you think about these? |
|
Yes, storing the map in the document sounds fine. I think you might be able to just use the add_to_doc function for updating it on insertion right now, which gets called after parse_html when the whole tree exists. |
|
Storing in the document is the way to go. It's worth thinking about whether to store just the first element with the given ID or all elements (in tree order) with the given ID in the hashmap. You definitely don't want to do this from the parser; you want to update the map when elements are actually inserted/removed into the document, which can happen without the parser being involved... and conversely the parser can create elements not going into the document (see innerHTML). |
|
Hi. My WIP is this stage: tetsuharuohzeki@8685a91
Before go to next step, I have some questions... This works when elements are appended to/removed from To resolve this problem, I doubt that https://github.com/mozilla/servo/blob/d465abdb1c2162ca9eeb72f391ea4a721332500a/src/components/script/script_task.rs#L714 : This Do you have any good idea about to store id & node pairs to this |
|
Note: the earlier pull requests implemented the fundamental parts, but we still lack support for multiple elements with the same id. |
…rse03 additional mathml tests as requested by Denis Ah-Kang
document.getElementById() needs to be implemented very efficiently. O(1) is is desirable