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

spec for toggleAttribute could be a bit clearer #3779

Closed
bzbarsky opened this issue Jun 27, 2018 · 5 comments
Closed

spec for toggleAttribute could be a bit clearer #3779

bzbarsky opened this issue Jun 27, 2018 · 5 comments
Labels
clarification Standard could be clearer

Comments

@bzbarsky
Copy link
Contributor

The current spec does this:

  1. If attribute is null, then:

    1. If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty string, and node document is the context object’s node document, then append this attribute to the context object, and then return true.
    2. Return false.

Note the need for a bunch of "then" in the first nested case. This might be easier to read as:

  1. If attribute is null, then:

    1. If force is given and is false, return false.

    2. Create an attribute whose local name is qualifiedName, value is the empty string, and node document is the context object’s node document.

    3. Append this attribute to the context object.

    4. Return true.

or so. Similar for the case when attribute is not null.

@jonathanKingston
Copy link

I can likely tackle this at the same time of the following bug: whatwg/dom#657.

Thanks for the feedback!

@jonathanKingston
Copy link

@bzbarsky does whatwg/dom#663 solve this?

@bzbarsky
Copy link
Contributor Author

bzbarsky commented Jun 29, 2018

It's a step in the right direction, but it still has the run-on "then" clauses instead of just breaking out its steps into a numbered list.

@jonathanKingston
Copy link

Ah sorry I missed that thanks, fixing now.

@jonathanKingston
Copy link

Updated and also moved out this attribute creation into it's own concept.

@zcorpan zcorpan added the clarification Standard could be clearer label Sep 1, 2018
@domenic domenic closed this as completed Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

4 participants