Skip to content

Support HTML5 form attribute #1

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

Merged
merged 7 commits into from
Nov 21, 2019
Merged

Support HTML5 form attribute #1

merged 7 commits into from
Nov 21, 2019

Conversation

SamMousa
Copy link
Contributor

@SamMousa SamMousa commented Nov 14, 2019

Copy link
Member

@Naktibalda Naktibalda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, could you implement a test for this feature?

Set up code coverage
@SamMousa
Copy link
Contributor Author

Yes I will; but to get an idea of current test status I want to set up coverage first.

Could you got to scrutinizer and add this repository? (I can set up the rest)

https://scrutinizer-ci.com/g/new

@DavertMik
Copy link
Member

Done!

@SamMousa
Copy link
Contributor Author

SamMousa commented Nov 15, 2019

As it turns out, the current implementation is actually pretty broken.

<html>

<body>
<form id="form1">

    <a href="https://google.nl">
    <button form="invalid" name="abc" >This will link</button>
    </a>
    <a href="https://google.nl">
    <button name="abc" >This will submit</button>
    </a>
</form>
<a href="https://google.nl">
    <button form="form1" name="abcdef" >This will submit</button>
</a>
</body>
</html>

From testing on chrome:
Buttons are associated to forms even when nested in an anchor, empty or invalid form attribute disassociate the button from the form; this might lead to it working as a hyperlink.

The codeception implemention will always use an anchor if that is found first.

I will rewrite the implementation of the button.

@SamMousa
Copy link
Contributor Author

Please review the code carefully.

Note: I do not throw an error when a form attribute contains an invalid ID, it might make sense to throw an error. (I used chrome as a reference, but browsers should be more forgiving than testing frameworks)

Note that an empty form attribute specifically disassociates an input from a containing form, so in such cases the link should be followed:

<form><a href="#"><button form="">Test</button></a></form>

@SamMousa SamMousa requested a review from Naktibalda November 19, 2019 08:05
Copy link
Member

@Naktibalda Naktibalda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Naktibalda Naktibalda merged commit 8f7383d into Codeception:master Nov 21, 2019
@Naktibalda Naktibalda mentioned this pull request Feb 15, 2020
janfejtek added a commit to janfejtek/lib-innerbrowser that referenced this pull request Jul 1, 2023
Naktibalda pushed a commit that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InnerBrowser: Support HTML5 button attributes
3 participants