GNOME Bugzilla – Bug 769363
[PATCH] GXmlElement : fix order in DomHTMLCollection for get_elements_by_class_name
Last modified: 2016-09-26 11:25:37 UTC
Created attachment 332453 [details] [review] GXmlElement : change order in collections. GXml add children collections before current node while webbrowser DOM do the opposite
Created attachment 332454 [details] [review] GXmlElement : change order in collections. get_elements_by_class_name : add child node only if class attribute has all required class (and don't add node for each class found).
Review of attachment 332454 [details] [review]: Is very important to patch both source code and unit tests. While I'm trying to correctly interpret DOM4 specification, most miss understanding will rise, please make sure you make GXml behave as expected and test it.
Please base your patch against latest commit: https://git.gnome.org/browse/gxml/commit/?id=936565d0e32a16a5b03f5dac0835574f2c33a5f8 Thanks again for all your help.
get_elements_by_tag_name() adding first current element has been fixed at commit: https://git.gnome.org/browse/gxml/commit/?id=88dd65655b53224521d71d9b7914de77985ab036
get_elements_by_class_name() now returns only nodes with same classes in search, no matter its order. Unit Tests was updated. This commit fix this bug. Please, close it. https://git.gnome.org/browse/gxml/commit/?id=cf0f1116f4c0a2751ed3e835f4bd37e09c954256
no. get_elements_by_class_name must return each node which has this class. please run example provided as attachment. node.getElementsByClassName in browsers returns all node
Created attachment 334591 [details] get_elements_by_class_name test
Created attachment 334592 [details] get_elements_by_class_name test html file
Created attachment 334593 [details] [review] [PATCH] get_elements_by_class_name : return nodes according to specification.
btw, get_elements_by_tag_name works. Thanks.
(In reply to Yannick Inizan from comment #8) > Created attachment 334592 [details] > get_elements_by_class_name test html file Your example just include one class to search for, but according to DOM specification at: https://www.w3.org/TR/dom/#concept-getelementsbyclassname We should: "Return a HTMLCollection rooted at root, whose filter matches descendant elements that have all their classes in classes" The sentence *all their classes in classes*, I understand that if you search for "class1 class2" will match any with "class1" or "class2" and "class1 class2", this is if you have at least one of the searched classes node match if node have less classes, but if you have equal should match if all of them are in search, and if node have more it should match if it has all on search. Is it correct?
I think this issue should be fixed at: https://git.gnome.org/browse/gxml/commit/?id=1e60cdf5387c619084f2fc563e69018116f72be6 please confirm. If so please close this bug.
Sorry I missed your credit, but I still will add tests to strip spaces in classes, then I'll add your credit about your work in latest commit.
Created attachment 335475 [details] [review] GXmlElement : fix order in DomHTMLCollection for get_elements_by_class_name.
Created attachment 335476 [details] HTML test file
Please check latest commit, it should fix your issue. https://git.gnome.org/browse/gxml/commit/?id=920d53fca8b60807eef8887115bc2a4a2bf70f70 If fixed, please close this bug in order to continue to make a 0.12 release.
fixed. thanks