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 single argument version of ContentNode#hasAttr #486

Open
mojavelinux opened this issue Jul 17, 2016 · 4 comments
Open

Add single argument version of ContentNode#hasAttr #486

mojavelinux opened this issue Jul 17, 2016 · 4 comments
Milestone

Comments

@mojavelinux
Copy link
Member

Add a single argument version of the method ContentNode#isAttr. The purpose of this method is to determine whether an attribute is set, regardless of the value. For example:

document.isAttr("sectnums");

The method will also need to accept a boolean flag to control whether to consider the inherited attribute (which is true by default).

node.isAttr("target", false);

If this method conflicts with other overloaded methods, we could consider changing the prefix to has.

document.hasAttr("sectnums")

This may actually be a better approach. This is consistent with the DOM (which uses the method name hasAttribute).

@mojavelinux mojavelinux added this to the v1.6.0 milestone Jul 17, 2016
@mojavelinux
Copy link
Member Author

@robertpanzer if you like hasAttr instead of isAttr, feel free to update the title of the issue.

@robertpanzer robertpanzer changed the title Add single argument version of ContentNode#isAttr Add single argument version of ContentNode#hasAttr Jul 19, 2016
@mojavelinux
Copy link
Member Author

In Asciidoctor.js, we decided to use more formal names, like getAttribute and setAttribute. I wonder if we should do the same in AsciidoctorJ 1.6.

@robertpanzer
Copy link
Member

I would be in favor of doing so.
Method names isAttr and getAttr don't feel very Java-like.

@mojavelinux
Copy link
Member Author

Exactly what we concluded for Asciidoctor.js. cc: @Mogztter

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

No branches or pull requests

2 participants