aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/attr.rs9
-rw-r--r--src/emitter.rs9
2 files changed, 15 insertions, 3 deletions
diff --git a/src/attr.rs b/src/attr.rs
index 48ae5b0..a4a3428 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -61,6 +61,7 @@ pub struct Attribute<'a, O> {
#[derive(Debug, PartialEq, Eq)]
pub struct AttributeOwned<O> {
/// The attribute name.
+ /// Uppercase ASCII characters (A-Z) have been converted to lowercase.
pub name: String,
/// The attribute value.
pub value: String,
@@ -76,6 +77,9 @@ pub struct AttributeOwned<O> {
impl<O> AttributeMap<O> {
/// Returns the attribute with the given name.
+ ///
+ /// The name must not contain any uppercase ASCII character (A-Z)
+ /// or the method will always return `None`.
pub fn get(&self, name: &str) -> Option<Attribute<O>> {
self.inner
.get_key_value(name)
@@ -85,6 +89,7 @@ impl<O> AttributeMap<O> {
impl<'a, O: Offset> Attribute<'a, O> {
/// Returns the attribute name.
+ /// Uppercase ASCII characters (A-Z) have been converted to lowercase.
pub fn name(&self) -> &'a str {
self.name
}
@@ -122,6 +127,10 @@ impl<'a, O: Offset> Attribute<'a, O> {
impl<O> Index<&str> for AttributeMap<O> {
type Output = str;
+ /// Returns the attribute value with the given name.
+ ///
+ /// The name must not contain any uppercase ASCII character (A-Z)
+ /// or the method will always panic.
fn index(&self, name: &str) -> &Self::Output {
&self.inner[name].value
}
diff --git a/src/emitter.rs b/src/emitter.rs
index b75334a..3fbb9e2 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -456,7 +456,8 @@ pub struct StartTag<O> {
/// expected.
pub self_closing: bool,
- /// The start tag's name, such as `"p"` or `"a"`.
+ /// The tag name.
+ /// Uppercase ASCII characters (A-Z) have been converted to lowercase.
pub name: String,
/// A mapping for any HTML attributes this start tag may have.
@@ -480,7 +481,8 @@ impl<O: Offset> StartTag<O> {
/// An HTML end/close tag, such as `</p>` or `</a>`.
#[derive(Debug, Eq, PartialEq)]
pub struct EndTag<O> {
- /// The ending tag's name, such as `"p"` or `"a"`.
+ /// The tag name.
+ /// Uppercase ASCII characters (A-Z) have been converted to lowercase.
pub name: String,
/// The source code span of the tag.
@@ -524,7 +526,8 @@ pub struct Doctype<O> {
/// [force-quirks flag]: https://html.spec.whatwg.org/multipage/parsing.html#force-quirks-flag
pub force_quirks: bool,
- /// The doctype's name. For HTML documents this should be "html".
+ /// The doctype's name. Uppercase ASCII characters (A-Z) have been
+ /// converted to lowercase. For HTML documents this should be "html".
pub name: String,
/// The doctype's public identifier.