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
feat: implement Element.getElementsByClassName #584
base: master
Are you sure you want to change the base?
Conversation
censujiang
commented
Nov 22, 2023
•
edited by karfau
edited by karfau
- https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname
- https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName
This bug is fix for #582 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #584 +/- ##
==========================================
+ Coverage 93.89% 93.96% +0.06%
==========================================
Files 8 8
Lines 2048 2070 +22
Branches 532 534 +2
==========================================
+ Hits 1923 1945 +22
Misses 125 125 ☔ View full report in Codecov by Sentry. |
Thank you for the effort. I would also consider this a PR that adds a Last but not least we will have to add test cases for all the newly supported code paths. |
I still don’t know why adding the function there can be successful. I just modified it based on observing the structure and general working principle of LiveNode, and after repeated testing on my project, I found that my approach was fine.I'm more curious why it works if I do this |
I will try my best to modify the relevant comments in the code, but I do not guarantee that this will comply with the specifications of this project. |
I have modified the relevant comment operations, but because I cannot write test code, I cannot submit the test code to you. |
Can you help me to understand why you can not add tests? |
Because I have never written test code in my life...😥 |
Ok, but do you want to learn it? There are plenty of existing tests in this repository to look at and of course you don't need to configure jest in this repo, you need to run The tests for xmldom/test/dom/document.test.js Line 46 in 14e96bc
should be a good starting point for what needs to be added to the tests for Element s:xmldom/test/dom/element.test.js Line 126 in 14e96bc
With the difference that you need to call the method on an element node instead of on the documentElement. Do you want to give it a try? PS: please use |
…g/xmldom into getElementsByClassName
I tried to write a little test code and it currently works |
That is a great starting point. When I'm back at my computer next week I will have a closer look at your implementation an potentially mising tests or possible refactoring in the context of this change. If you have a resource that shows this, please provide a link. |
okay, Thank you! |