[wp-trac] [WordPress Trac] #63824: button is not a self-closing HTML element and needs a closing tag
WordPress Trac
noreply at wordpress.org
Wed Aug 13 23:01:52 UTC 2025
#63824: button is not a self-closing HTML element and needs a closing tag
--------------------------+----------------------
Reporter: kkmuffme | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Media | Version: 4.8
Severity: trivial | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Comment (by siliconforks):
Replying to [comment:7 ocean90]:
> In jQuery, `$( '<element />' )` is just a shorthand for `$(
'<element></element>' )`. jQuery will not add `<element />` to the DOM,
instead it uses `createElement( element )` under the hood.
>
> See
https://github.com/jquery/jquery/blob/9c84195b9445645ba22f1c88d464d0b7d5ba22dd/src/core/parseHTML.js#L34
and
https://github.com/jquery/jquery/blob/9c84195b9445645ba22f1c88d464d0b7d5ba22dd/src/core/var/rsingleTag.js#L3C25-L3C90.
I think that is true only if the element does not have any attributes.
If the element has attributes (as in `<button type="button"
class="browser" />`), then jQuery calls `buildFragment()`, which then
creates a `div` element and uses `innerHTML`:
https://github.com/jquery/jquery/blob/9c84195b9445645ba22f1c88d464d0b7d5ba22dd/src/manipulation/buildFragment.js#L36-L48
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63824#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list