Skip to content
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

Add custom boolean attribute support #503 #555

Merged
merged 2 commits into from
Jul 5, 2015
Merged

Add custom boolean attribute support #503 #555

merged 2 commits into from
Jul 5, 2015

Conversation

Legioth
Copy link
Contributor

@Legioth Legioth commented Apr 18, 2015

  • Adds BooleanAttribute that writes out itself without a value
  • Adds API in Element for setting boolean attributes
  • Update parser to distinguish between no value and empty value

* Adds BooleanAttribute that writes out itself without a value
* Adds API in Element for setting boolean attributes
* Update parser to distinguish between no value and empty value
assertFalse(div.hasAttr("false"));

assertEquals("<div true></div>", div.outerHtml());
}
Copy link
Owner

Choose a reason for hiding this comment

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

Can you assert their type here also?

@jhy
Copy link
Owner

jhy commented Apr 22, 2015

Thanks, looks interesting. Can you check what the behavior should be for XML parsing and XML syntax output? Thinking that at least for XML syntax output, boolean attributes should actually output as empty string attributes.

@Legioth
Copy link
Contributor Author

Legioth commented May 18, 2015

From what I have found, the original XHTML specification only allowed the format attribute="attribute".

Latest XHTML specs also allow attribute="" according to e.g. https://html.spec.whatwg.org/#boolean-attributes

For attributes defined as boolean using XML Schema, the format is attribute="true" or attribute="1" (not compatible with XHTML version).

@Legioth
Copy link
Contributor Author

Legioth commented Jun 22, 2015

Carefully bumping this.

jhy added a commit that referenced this pull request Jul 5, 2015
Add custom boolean attribute support #503
@jhy jhy merged commit e5e1846 into jhy:master Jul 5, 2015
@jhy
Copy link
Owner

jhy commented Jul 5, 2015

Thanks! Merged.

jhy added a commit that referenced this pull request Jul 5, 2015
zazi pushed a commit to dswarm/jsoup that referenced this pull request Oct 15, 2015
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.

2 participants