doc edits

This commit is contained in:
Adam D. Ruppe 2022-12-16 11:20:43 -05:00
parent 18cc05a34d
commit 131e467f4d
1 changed files with 13 additions and 4 deletions

17
dom.d
View File

@ -4167,19 +4167,26 @@ struct DataSet {
/// Proxy object for attributes which will replace the main opDispatch eventually
/// Group: implementations
struct AttributeSet {
///
/// Generally, you shouldn't create this yourself, since you can use [Element.attrs] instead.
this(Element e) {
this._element = e;
}
private Element _element;
/// Sets a `value` for `attribute`. If doens't exists, creates it
/++
Sets a `value` for attribute with `name`. If the attribute doesn't exist, this will create it, even if `value` is `null`.
+/
string set(string name, string value) {
_element.setAttribute(name, value);
return value;
}
/// Provides support for testing with `in`
/++
Provides support for testing presence of an attribute with the `in` operator.
History:
Added December 16, 2020 (dub v10.10)
+/
auto opBinaryRight(string op : "in")(string name) const
{
return name in _element.attributes;
@ -4192,7 +4199,9 @@ struct AttributeSet {
assert("test" !in doc.root.attrs);
}
/// Returns attribute `name`, or `null` if doesn't exist
/++
Returns the value of attribute `name`, or `null` if doesn't exist
+/
string get(string name) const {
return _element.getAttribute(name);
}