1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef BorrowedAttrInfo_h__
8 #define BorrowedAttrInfo_h__
10 #include "mozilla/Assertions.h"
15 namespace mozilla::dom
{
18 * Struct that stores info on an attribute. The name and value must either both
19 * be null or both be non-null.
21 * Note that, just as the pointers returned by GetAttrNameAt, the pointers that
22 * this struct hold are only valid until the element or its attributes are
23 * mutated (directly or via script).
25 struct BorrowedAttrInfo
{
26 BorrowedAttrInfo() : mName(nullptr), mValue(nullptr) {}
28 BorrowedAttrInfo(const nsAttrName
* aName
, const nsAttrValue
* aValue
);
30 BorrowedAttrInfo(const BorrowedAttrInfo
& aOther
);
32 const nsAttrName
* mName
;
33 const nsAttrValue
* mValue
;
35 explicit operator bool() const { return mName
!= nullptr; }
38 } // namespace mozilla::dom