From 131e467f4d3e12ac0ceb0db8a5269e52b7ef2c65 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Fri, 16 Dec 2022 11:20:43 -0500 Subject: [PATCH] doc edits --- dom.d | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dom.d b/dom.d index 8539122..65fabf5 100644 --- a/dom.d +++ b/dom.d @@ -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); }