Skip to content

[3.0] Stop every topic row emitting an attribute named " - #9454

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/messageindex-stray-attribute
Open

[3.0] Stop every topic row emitting an attribute named "#9454
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/messageindex-stray-attribute

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

The wrapper inside each topic's info cell builds its data-msg-id by hand, leaving the closing quote to the string that follows it:

<div ', (!empty($topic['quick_mod']['modify']) ? 'data-msg-id="' . $topic['first_post']['id'] : ''), '">

That works when there is an id to write. When there is not — which is the default, since display_quick_mod is a theme option that is off unless a member turns it on — the ternary contributes nothing and the row emits <div ">. Every topic, on every message index, carries an attribute whose name is a double quote:

{"attrs": ["\"=\"\""], "outer": "<div \"=\"\"> <div id=\"icons12\" class=\"icons floatright\">…"}

Same shape as the checked" problem fixed in #9428: the attribute is assembled across the boundary between the ternary and the literal. Putting the whole thing inside the ternary fixes it.

before after
quick mod off (default) <div "> <div>
quick mod on data-msg-id="12" data-msg-id="12"

Measured on six topic rows with the option off, then on, by enabling display_quick_mod for the test account.

Separately: the attribute's consumer does not work

Not fixed here, because it needs a rewrite rather than a correction, but worth recording while it is in front of us. QuickModifyTopic is constructed unconditionally on every message index and is supposed to give topics inline subject editing on double-click. It does not, for three independent reasons:

  1. It reads the attribute off the wrong element — el.children[1].dataset.msgId is the .info cell, while data-msg-id is on the div one level inside it. Measured with the option on: .info gives undefined while its child gives data-msg-id="12". The listener is therefore never attached.
  2. Even attached, the handler is bound as this.modify_topic.bind(this, …dataset.msgId), so modify_topic(topic_id, first_msg_id) receives the message id as topic_id and the click event as first_msg_id.
  3. It then looks for document.getElementById('msg_' + first_msg_id), but the template emits id="msg12" — no underscore.

I have left all three alone. Reviving the feature means verifying the whole AJAX round trip, which is its own piece of work, and I did not want to bury it inside a markup fix.

Issues References (Fixes|Related|Closes)

Related: #9428, #7933

The wrapper inside each topic's info cell builds its data-msg-id by hand,
leaving the closing quote to the string that follows it:

	<div ', (!empty($topic['quick_mod']['modify']) ? 'data-msg-id="' . $topic['first_post']['id'] : ''), '">

That works when there is an id to write. When there is not - which is the
default, since display_quick_mod is off unless a member turns it on - the
ternary contributes nothing and the row emits <div ">, so every topic on
every message index carries an attribute whose name is a double quote.

Puts the whole attribute inside the ternary, quotes and all.

	quick mod off   <div "> becomes <div>
	quick mod on    data-msg-id="12" either way

Signed-off-by: Mathias Albert <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 6 milestone Aug 9, 2026
@albertlast albertlast mentioned this pull request Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants