-
Notifications
You must be signed in to change notification settings - Fork 320
Refactor toggle attribute #663
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
9c8351b
63a9c3e
543336c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ribute()
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6189,6 +6189,22 @@ 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> | ||
| given a <var>qualifiedName</var>, <var>value</var> and <a for="/">element</a> <var>element</var>, run these steps: | ||
|
|
||
| <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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the context object* throughout |
||
| <a for=Node>node document</a>. | ||
|
|
||
| <li><a lt="append an attribute">Append</a> this <a>attribute</a> to | ||
| <a>element</a> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You want |
||
|
|
||
| <li>Return. | ||
| </ol> | ||
|
|
||
| To <dfn export id=concept-element-attributes-get-valid-by-name>get a valid attribute by name</dfn> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "validate and get an attribute by name" perhaps? |
||
| given a <var>qualifiedName</var>, and <a for="/">element</a> <var>element</var>, run these steps: | ||
|
|
||
|
|
@@ -6548,11 +6564,8 @@ method, when invoked, must run these steps: | |
| <ol> | ||
| <li><p>Let <var>qualifiedName</var> and <var>attribute</var> be the result of running <a>get a valid attribute by name</a> given the <var>qualifiedName</var> and <a>context object</a> | ||
|
|
||
| <li><p>If <var>attribute</var> is null, 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 | ||
| <a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a> to | ||
| <a>context object</a>, and then return. | ||
|
|
||
| <li><p>If <var>attribute</var> is null, run <a>create an attribute by value</a> given the <var>qualifiedName</var>, <var>value</var> and <a>context object</a>, and then return. | ||
|
|
||
| <li><p><a lt="change an attribute">Change</a> <var>attribute</var> from <a>context object</a> to | ||
| <var>value</var>. | ||
|
|
@@ -6606,13 +6619,7 @@ method, when invoked, must run these steps: | |
| <ol> | ||
| <li><p>If <var>force</var> is given and is false, return false. | ||
|
|
||
| <li><p>Create an <a>attribute</a> whose | ||
| <a for="Attr">local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is the empty | ||
| string, and <a for=Node>node document</a> is the <a>context object</a>'s | ||
| <a for=Node>node document</a>. | ||
|
|
||
| <li><a lt="append an attribute">Append</a> this <a>attribute</a> | ||
| to the <a>context object</a>. | ||
| <li><p>Run <a>create an attribute by value</a> given the <var>qualifiedName</var>, <var>the empty string</var> and <a>context object</a>. | ||
|
|
||
| <li>Return true. | ||
| </ol> | ||
|
|
||
There was a problem hiding this comment.
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.