Rename name argument to tag_name to avoid conflict with HTML standard 'name' attribute.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
The methods `find` and `find_all`, as well as every other `find` method, take as an argument for the `tagName` the argument `name`.
Then there is the possibility in the `find` to define extra `attributes` the dom node should have, e.g.:
soup.
# [<a class="sister" href="http://
So you can't select for example this:
soup.
# [<input name="email"
In JavaScript the name of the tag is called `tagName`, so it would only be logical to rename the argument `name` to `tag_name`.
I know that there is the `attr` argument and this is a breaking change, but to be consistent with the W3C spec this step is only logical.
Especially the attribute `name` is such frequently used.
I could understand if you don't want to do this change, but I think this would lead to a more unified developer experience.
Of course, this is no change to make in `bs4`, but should be considered for `bs5`.
summary: |
- Rename find and find_all args + Rename name argument to tag_name to avoid conflict with HTML standard + 'name' attribute. |
This is a reasonable request, but I've decided not to make this change. The 'name' argument has been called that for twelve years and this is the first request to change it. Given the magnitude of the change and the long time frame necessary to change how 'name' works, I think it's better to leave it alone.
I've added a section to the documentation showing how to use attrs to search by the 'name' attribute.