Skip to content

Adding node name getter with tests #11351

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

Closed
wants to merge 1 commit into from

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Jul 8, 2014

This PR was submitted on the symfony/DomCrawler read-only repository and moved automatically to the main Symfony repository (closes symfony/dom-crawler#17).

Based on the use case came up in a SO question (http://stackoverflow.com/questions/22564465/getting-the-tag-name-of-a-element-crawled-with-domcrawler-in-php) I propose a new helper function to get the name of the active node

@stof
Copy link
Member

stof commented Jul 8, 2014

this needs a rebase

@stof
Copy link
Member

stof commented Jul 8, 2014

I think the name should be tagName() or nodeName() rather than just name(), to avoid people expecting it to the the name attribute

@fejese
Copy link
Contributor

fejese commented Jul 17, 2014

@stof , I choose the name 'name' to be more consistent with other methods, like attr, text, and html that are all relevant to the node and not the attributes. Do you think that it is better to leave that consistence behind just to make the functionality more clear?

@fejese
Copy link
Contributor

fejese commented Jul 17, 2014

Also, I realised that I did not read all the documentation on how to contribute to symfony so after deciding on the name I'll make the necessary adjustments.

@stof
Copy link
Member

stof commented Jul 18, 2014

@fejese but attr(), text() and html() don't have such confusion (and the method name we used are matching the jQuery ones which were known by many people already). I fear the confusion here with people not thinking about name() as being the node name.

Btw, if you want to make the necessary adjustments, you will have to create a new PR, as this one is opened from @fabpot's fork.

@fejese
Copy link
Contributor

fejese commented Jul 18, 2014

@stof, good point, I'll rename it. I think nodeName would be the more appropriate choice.
Of course I'll create a new PR.

@jakzal
Copy link
Contributor

jakzal commented Jul 20, 2014

replaced by #11426

@jakzal jakzal closed this Jul 20, 2014
fabpot added a commit that referenced this pull request Jul 25, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DomCrawler] Added node name getter

[DomCrawler] Added node name getter

Based on the use case came up in a SO question (http://stackoverflow.com/questions/22564465/getting-the-tag-name-of-a-element-crawled-with-domcrawler-in-php) I propose a new helper function to get the name of the active node

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | symfony/symfony-docs#4039

(Follow up of #11351)

Commits
-------

2fee576 [DomCrawler] Added node name getter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants