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 upfix getElementsByTagName() #12844
fix getElementsByTagName() #12844
Conversation
|
+S-needs-code-changes +S-awaiting-answer Reviewed 10 of 10 files at r1. components/script/dom/document.rs, line 2069 [r1] (raw file):
You don't need to clone the name here, instead in the let result = HTMLCollection::match_elements_by_qualified_name(
&self.window, self.upcast(), entry.key().clone());components/script/dom/htmlcollection.rs, line 116 [r1] (raw file):
Please just rename that to components/script/dom/htmlcollection.rs, line 119 [r1] (raw file):
Nit: for consistency, rename that components/script/dom/htmlcollection.rs, line 140 [r1] (raw file):
Where do you discriminate steps 2 and 3 from the spec here? components/script/dom/htmlcollection.rs, line 150 [r1] (raw file):
Why do you look at the prefix at all? To what does that correspond in the spec? Comments from Reviewable |
We can't just compare element`s local name with qualified name because sometimes qualified name is prefix + ':' + local name. https://dom.spec.whatwg.org/#concept-element-qualified-name
You`re right. I have a bug here. But reading through spec I found a mismatch.
https://dom.spec.whatwg.org/#dom-document-getelementsbytagname Case insensitive compare and lowercasing qualified name before compare is not the same thing. I quess the right thing is lowercasing as written here but I think spec should be fixed. |
Got it.
The sentence you copied is from a non-normative note and when the DOM spec talks about case-insensitivity it means ASCII case-insensitivity. ASCII case-insensitivity comparison and comparison after ASCII lowercasing are the same things. |
|
-S-awaiting-answer -S-awaiting-review +S-needs-code-changes Reviewed 3 of 3 files at r2. components/script/dom/htmlcollection.rs, line 122 [r2] (raw file):
If you disambiguate this way, please give each filter a name that makes sense. For this one it could be: struct AllFilter;components/script/dom/htmlcollection.rs, line 133 [r2] (raw file):
You can't do that here, because Comments from Reviewable |
I do not understand that at all. How root could change if it passed immutable in by_qualified_name? |
|
|
|
-S-awaiting-review +S-needs-code-changes Reviewed 1 of 1 files at r3. components/script/dom/htmlcollection.rs, line 122 [r3] (raw file):
Make it a unit struct: struct AllFilter;Comments from Reviewable |
Ok. But I still do not understand. I'm assuming that tree won't change while by_qualified_name() is running. Isn't it true? |
|
It's wrong. That method returns a
|
|
@kevgs Need help with this? |
|
Yes. I have no idea how to replase root.is_in_html_doc(). |
|
You need to merge the two different kind of collections into a single one, that checks whether |
|
|
|
Sorry, but it looks like I have neither time nor skill to accomplish this task. Hope this uncompleted patch will help someone to fix that issue. |
|
Thanks for letting us know! |
mskrzypkows
commented
Oct 20, 2016
|
components/script/dom/htmlcollection.rs, line 140 at r1 (raw file):
|
|
@mskrzypkows You need to use that function in the filter itself, and not use it to return different filters. |
kevgs commentedAug 13, 2016
•
edited by KiChjang
This is a continue of work started at #11705
Added test, fixed code for better use of Atom.
Fixes #11596.
r? @nox
This is implemented in document.rs with tag_map field.
This change is