@@ -121,6 +121,10 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> {
121121 }
122122
123123 /// Sets the tag name of the element.
124+ ///
125+ /// The new tag name must be in the same namespace, have the same content model, and be valid in its location.
126+ /// Otherwise change of the tag name may cause the resulting document to be parsed in an unexpected way,
127+ /// out of sync with this library.
124128 #[ inline]
125129 pub fn set_tag_name ( & mut self , name : & str ) -> Result < ( ) , TagNameError > {
126130 let name = self . tag_name_bytes_from_str ( name) ?;
@@ -134,16 +138,31 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> {
134138 Ok ( ( ) )
135139 }
136140
137- /// Whether the element is explicitly self-closing, e.g. `<foo />`.
141+ /// Whether the tag syntactically ends with `/>`. In HTML content this is purely a decorative, unnecessary, and has no effect of any kind.
142+ ///
143+ /// The `/>` syntax only affects parsing of elements in foreign content (SVG and MathML).
144+ /// It will never close any HTML tags that aren't already defined as [void][spec] in HTML.
145+ ///
146+ /// This function only reports the parsed syntax, and will not report which elements are actually void in HTML.
147+ /// Use [`can_have_content()`][Self::can_have_content] to check if the element is non-void.
148+ ///
149+ /// [spec]: https://html.spec.whatwg.org/multipage/syntax.html#start-tags
150+ ///
151+ /// If the `/` is part of an unquoted attribute, it's not parsed as the self-closing syntax.
138152 #[ inline]
139153 #[ must_use]
140154 pub fn is_self_closing ( & self ) -> bool {
141155 self . start_tag . self_closing ( )
142156 }
143157
144- /// Whether the element can have inner content. Returns `true` unless the element is an [HTML void
145- /// element](https://html.spec.whatwg.org/multipage/syntax.html#void-elements) or has a
146- /// self-closing tag (eg, `<foo />`).
158+ /// Whether the element can have inner content.
159+ ///
160+ /// Returns `true` if the element isn't a [void element in HTML][void],
161+ /// or is in **foreign content** and doesn't have a self-closing tag (eg, `<svg />`).
162+ ///
163+ /// [void]: https://html.spec.whatwg.org/multipage/syntax.html#void-elements
164+ ///
165+ /// Note that the self-closing syntax has no effect in HTML content.
147166 #[ inline]
148167 #[ must_use]
149168 pub fn can_have_content ( & self ) -> bool {
0 commit comments