Originally created by @bendtherules on GitHub (Nov 10, 2020).
Original GitHub issue: https://github.com/bendtherules/UiQuestions/issues/6
Originally assigned to: @bendtherules on GitHub.
## Covers -
1. class, classList, id
2. get/set/remove any attribute
3. Accessing most attributes directly like .value or .disabled
4. data attributes
5. (-) style
## Details -
Attribute has the form `name="value"`. Value is optional , so it can be just the attribute name - like `<input required>` which is same as `required=""`.
1. [`Element.attributes`](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes) - returns all attributes
Get/set - `getAttribute()`, `setAttribute()`
(-) Lower level - `createAttribute()`, `setAttributeNode()`
Remove - `removeAttribute()`
Check - `hasAttribute()`
(-) Boolean attributes - `toggleAttribute()`
2. Data attributes - using [`.dataset`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset), maybe [css access](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes#CSS_access)
3. Class, id - [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className), [classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList), [id](https://developer.mozilla.org/en-US/docs/Web/API/Element/id)
4. (-) Inline styles - [`.style`](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style), [`CSSStyleDeclaration`](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration) and camel-case names.
---
(-) means less used and Ok to skip
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @bendtherules on GitHub (Nov 10, 2020).
Original GitHub issue: https://github.com/bendtherules/UiQuestions/issues/6
Originally assigned to: @bendtherules on GitHub.
Covers -
Details -
Attribute has the form
name="value". Value is optional , so it can be just the attribute name - like<input required>which is same asrequired="".Element.attributes- returns all attributesGet/set -
getAttribute(),setAttribute()(-) Lower level -
createAttribute(),setAttributeNode()Remove -
removeAttribute()Check -
hasAttribute()(-) Boolean attributes -
toggleAttribute()Data attributes - using
.dataset, maybe css accessClass, id - className, classList, id
(-) Inline styles -
.style,CSSStyleDeclarationand camel-case names.(-) means less used and Ok to skip