asciidoctorj
asciidoctorj copied to clipboard
Add single argument version of ContentNode#hasAttr
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).
@robertpanzer if you like hasAttr instead of isAttr, feel free to update the title of the issue.
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.
I would be in favor of doing so.
Method names isAttr
and getAttr
don't feel very Java-like.
Exactly what we concluded for Asciidoctor.js. cc: @Mogztter