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

Refactor toggle attribute #663

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonathanKingston
Copy link
Contributor

@jonathanKingston jonathanKingston commented Jun 29, 2018

Solves:
#657
whatwg/html#3779

As I understand it vars are not mutable and are instead copied, right? This mean I still have to copy from "get an attribute by name" the code.

Would there be a way to simplify this further perhaps? I could copy out the two common steps in the body of "get an attribute by name" and "get valid an attribute by name" into another concept?

Are there better names for the concept?


💥 Error: 500 Internal Server Error 💥

PR Preview failed to build. (Last tried on Jan 15, 2021, 7:33 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 CSS Spec Preprocessor - CSS Spec Preprocessor is the web service used to build Bikeshed specs.

🔗 Related URL

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at 
 [no address given] to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at api.csswg.org Port 443</address>
</body></html>

If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

I quite like the direction this is going in. We do end up with a few more lines, but it's much more clear what is going on.

@@ -6189,6 +6189,40 @@ in an <a for="/">element</a> <var>element</var>, run these steps:

<hr>


To <dfn export id=concept-element-attributes-set-by-name>create an attribute by value</dfn>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should name this "create and append an attribute"? Or maybe I don't understand "by value".

The other thing I'm thinking is that it would be nice if https://dom.spec.whatwg.org/#concept-element-attributes-set-value could invoke this algorithm as well. That would require additional arguments for namespace/prefix, but seems doable.

<a for=Node>node document</a>.

<li><a lt="append an attribute">Append</a> this <a>attribute</a> to
<a>element</a>
Copy link
Member

Choose a reason for hiding this comment

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

You want <var>element</var> here and a dot.

<ol>
<li><p>Create an <a>attribute</a> whose
<a for="Attr">local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
<var>value</var>, and <a for=Node>node document</a> is <a>context object</a>'s
Copy link
Member

Choose a reason for hiding this comment

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

the context object* throughout

<li>Return.
</ol>

To <dfn export id=concept-element-attributes-get-valid-by-name>get a valid attribute by name</dfn>
Copy link
Member

Choose a reason for hiding this comment

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

"validate and get an attribute by name" perhaps?

<li><p><a lt="remove an attribute by name">Remove an attribute</a> given <var>qualifiedName</var> and the
<a>context object</a>.

<li>Return false.
Copy link
Member

Choose a reason for hiding this comment

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

<li><p> (also above)

@annevk annevk added the do not merge yet Pull request must not be merged per rationale in comment label Dec 6, 2019
Base automatically changed from master to main January 15, 2021 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge yet Pull request must not be merged per rationale in comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants